How to add validation/restrictions for HTML5 date field without jquery/javascript

前端 未结 1 544
萌比男神i
萌比男神i 2020-11-29 11:16

Is it possible to add validations/restrictions to date element using HTML api,without jquery?

I am currently using jquery datePicker to display calendar,and for addi

相关标签:
1条回答
  • 2020-11-29 12:04

    You can use min and max attributes on your date input.

    Spec : http://www.w3.org/TR/html-markup/input.date.html

    Edit :

    • Afaik, there is no way to disable specific days using HTML5 date input...

    • If you want to be cross-browser, use Modernizr and provide a fallback for old browsers (for example jQuery datePicker) : http://net.tutsplus.com/tutorials/html-css-techniques/how-to-build-cross-browser-html5-forms/

    0 讨论(0)
提交回复
热议问题