HTML5上的type = date的最小/最大属性 [英] min/max attribute with type = date on HTML5

查看:504
本文介绍了HTML5上的type = date的最小/最大属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



这是我的代码:


我有一些问题要设置一个最小和最大的YEAR与HTML5日期输入。

 < input required =requiredmin =1900-01-01max =2099-09-13type =dateclass = form-controlid =inputDataNascimento> 

根本不起作用。





我在做有问题?这是一个错误?



注意:我正在使用Google Chrome和Twitter Bootstrap 3。

解决方案

某些浏览器(如Safari和Internet Explorer)不支持此功能,这可能是您的问题。通过Javascript进行验证。



支持此功能的浏览器列表可以在以下网址查看:...



http://html5test.com/compare /browser/chrome-33/firefox-27/opera-19/safari-7.0/ie-11.html


I'm having some problems to set a minimum and a maximum YEAR with HTML5 date input.

Here is my code:

<input required="required"  min="1900-01-01" max="2099-09-13" type="date" class="form-control" id="inputDataNascimento">

It doesn't work at all.

Am I doing something wrong? Is this a bug?

Notes: I'm using Google Chrome and Twitter Bootstrap 3.

解决方案

Some browsers like Safari and Internet Explorer does not support this functionality, this may be your problem. Write validation via Javascript.

The list of browers that support this feature can be seen at:...

http://html5test.com/compare/browser/chrome-33/firefox-27/opera-19/safari-7.0/ie-11.html

这篇关于HTML5上的type = date的最小/最大属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆