【发布时间】:2016-09-23 05:20:20
【问题描述】:
我需要一个允许字符“:”和“。”的数字字段。要提交。我基本上需要一个默认为用户使用字母数字键盘的文本字段,因为通常他们会输入时间“2”或“3.3”(有时他们会输入“1:30”)。这是我确实拥有的代码,但在某些 Android 设备上,webview 搞砸了,人们无法在 mobile_form_hours 字段中输入任何内容。有人有其他想法吗?我尝试在提交表单之前将其保留为数字字段并将其更改为文本字段,或者在提交按钮上按下鼠标,但这两者都不起作用。
<input type="text" id="mobile_form_hours" />
$(document).on 'touchstart', '#mobile_form_hours', ->
$(this).attr('type', 'number');
$(document).on 'keydown blur', '#mobile_form_hours', ->
$(this).attr('type', 'text');
【问题讨论】:
标签: javascript android iphone forms