使用 jQuery 的日期掩码

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6016299/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-26 20:13:51  来源:igfitidea点击:

Date mask with jQuery

jquery

提问by Kris-I

Looking for a mask where I can enter dd/mm/yyyy (with a limit of 31 for dd, 12 for mm) I tried several but possible to enter 24/24/2024

寻找可以输入 dd/mm/yyyy 的掩码(dd 的限制为 31,mm 的限制为 12)我尝试了几个,但可以输入 24/24/2024

Thanks,

谢谢,

回答by piddl0r

I use masked-input-pluginand handle validation separately with the rest of the form.

我使用masked-input-plugin并与表单的其余部分单独处理验证。

回答by dertkw

Try the jQuery Date Entry

尝试jQuery 日期输入

A jQuery plugin that sets an input field up to accept a date value using a spinner.

一个 jQuery 插件,它使用微调器设置输入字段以接受日期值。

enter image description here

在此处输入图片说明

Description from jQuery Plugin page:

来自jQuery 插件页面的描述:

  • Can be driven via the keyboard or with the mouse.
  • Accepts direct date entry via the keyboard.
  • Allow various date formats including day and/or month names.
  • Can restrict to a minimum and/or maximum date.
  • Localisations available.
  • 可以通过键盘或鼠标驱动。
  • 接受通过键盘直接输入日期。
  • 允许各种日期格式,包括日和/或月名称。
  • 可以限制为最小和/或最大日期。
  • 可用的本地化。