HTML 5输入类型='日期'禁用键盘输入 [英] HTML 5 Input type='date' disable keyboard input
问题描述
我正在使用Chrome Packaged应用程序,因此我的代码只能在Chrome中使用。
我有以下输入
< input type =date/>
https://jsfiddle.net/jhbo4q2k/
在Chrome上,这会自动添加DatePicker。我只想保留这个Datepicker并通过键盘禁用输入。
这可能吗?
编辑:
接受的答案有效。请谨慎对待
https:/ /developer.chrome.com/extensions/tut_migration_to_manifest_v2#inline_scripts
您无法在打包的应用程序中使用内联脚本。
<您可以使用
onkeydown
并阻止用户输入值。
< input type =dateonkeydown =return false/>
I am working on a Chrome Packaged App so my code should only work in Chrome.
I have the following input
<input type="date" />
https://jsfiddle.net/jhbo4q2k/
On Chrome this automatically adds a DatePicker. I would like to only keep this Datepicker and disable the input by keyboard.
Is this possible?
EDIT:
The accepted answer works. Just be wary of this
https://developer.chrome.com/extensions/tut_migration_to_manifest_v2#inline_scripts
You cant use inline scripts in a packaged app.
You can use onkeydown
and prevent user from entering the value.
<input type="date" onkeydown="return false" />
这篇关于HTML 5输入类型='日期'禁用键盘输入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!