如何为没有jQuery / javascript的HTML5日期字段添加验证/限制 [英] How to add validation/restrictions for HTML5 date field without jquery/javascript
问题描述
是否有可能使用HTML api添加验证/限制日期元素,而不使用jquery?
Is it possible to add validations/restrictions to date element using HTML api,without jquery?
我正在使用jquery datePicker来显示日历,并添加限制使用datePicker的beforeShow方法。
I am currently using jquery datePicker to display calendar,and for adding restrictions using the beforeShow method of the datePicker.
现在我正在尝试使用HTML5日历,并想知道如何添加限制(例如:禁用weendends / holidays)到HTML5日历。
有人可以指点我吗?
Now i am trying to use the HTML5 calender and want to know how to add restrictions(eg:disable weendends/holidays) to the HTML5 calendar. Can somebody point me in right direction?
推荐答案
您可以使用 min $日期输入中的c $ c>和
max
属性。
规格: http://www.w3.org/TR/html-markup/input.date.html
修改:
-
Afaik ,无法使用HTML5日期输入禁用特定日期......
Afaik, there is no way to disable specific days using HTML5 date input...
如果您想要跨浏览器,请使用 Modernizr 并为旧浏览器提供回退(例如jQuery datePicker): http://net.tutsplus.com/tutorials/html-css-techniques/how-to -build-cross-browser-html5-forms /
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/
这篇关于如何为没有jQuery / javascript的HTML5日期字段添加验证/限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!