我正在使用Chrome Packaged应用程序,因此我的代码只能在Chrome中使用。
我有以下输入
< input type =date/>jsfiddle/jhbo4q2k/
在Chrome上,这会自动添加DatePicker。我只想保留这个Datepicker并通过键盘禁用输入。
这可能吗?
编辑:
接受的答案有效。请谨慎对待
https:/ /developer.chrome/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" />jsfiddle/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
developer.chrome/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输入类型='日期'禁用键盘输入
发布评论