HTML5日期输入6位数字的年份 [英] HTML5 Date Input 6 digit year

查看:81
本文介绍了HTML5日期输入6位数字的年份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的表单上有一个标准的< input/> 控件,装饰有 type ="date"

I have a standard <input /> control on my form, decorated with type="date"

渲染后,它会显示 yyyy-mm-dd 的正确水印,并且您可以正确选择日期.
但是,当您尝试输入值时,将扩展为6位数字,而不是4位数字.我添加了屏幕截图,以帮助演示我遇到的问题.

When rendered, it displays the correct watermark of yyyy-mm-dd, and you can select a date correctly.
However, when you try type in a value, the year extends to 6 digits, instead of four. I have added screenshots to help demonstrate the issue I'm having.

还有其他人得到这个吗?我正在使用Chrome(版本35.0.1916.153 m)作为默认浏览器.
我想要一种强制进行4年不涉及额外JS的输入的方法.

Is anyone else getting this? I'm using Chrome ( Version 35.0.1916.153 m ) as my default browser.
I'd like a way to force a 4year input that doesn't involve extra JS.

推荐答案

据我所知,max属性正在工作...

the max attribute is working, as far as i know...

max的格式很棘手,如果您输入正确的格式,一切都会正常....

the format of max is trickey, if you put the correct format everything will work fine....

例如:

http://www.w3schools.com/html/tryit.asp?filename=tryhtml5_input_max_min_date

这篇关于HTML5日期输入6位数字的年份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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