简体   繁体   中英

Disabled Chrome's HTML5 calendar control

Chrome is automatically adding a calendar widget for any fields that are <input type="date"> and also adds some strage date formatting to the field as well. Since the original html spec called for any input type that's not one of checkbox,radio,text,password,file etc being rendered as a normal text field this was how we were triggering our calendar widget. Is there a meta tag or some other option we can set to prevent chrome from doing this?

Screenshot (please note that this is not our code, chrome is automatically adding this): 在此处输入图片说明

The only way to prevent the native datepicker is not to give the input a type="date" attribute; simply use a straight type="text" input. There are some major advantages of using type="date" most notably optimized input capabilities for mobile devices. But to avoid the picker from displaying you'll have to forego those.

I discuss the advantages and disadvantages of using <input type="date"> on my blog - http://tjvantoll.com/2012/06/30/creating-a-native-html5-datepicker-with-a-fallback-to-jquery-ui/ .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM