我们的应用程序在输入字段上使用selectionStart来确定当用户按下箭头键时是否自动将用户移动到下一个/上一个字段(即,当选择位于文本末尾并且用户按下右箭头时我们移动到下一个字段,否则)
Chrome现在阻止在type ="number"的地方使用selectionStart.它现在抛出异常:
Failed to read the 'selectionStart' property from 'HTMLInputElement': The input element's type ('number') does not support selection.
Run Code Online (Sandbox Code Playgroud)
见如下:
https://codereview.chromium.org/100433008/#ps60001
http://www.whatwg.org/specs/web-apps/current-work/multipage/the-input-element.html#do-not-apply
有没有办法在type ="number"的输入字段中确定插入符的位置?
Chrome已对我的测试中导致此错误的数字输入进行了更改
Uncaught InvalidStateError: Failed to read the 'selectionStart' property from 'HTMLInputElement': The input element's type ('number') does not support selection
我想了解为什么数字/电子邮件输入不能选择(原文如此)?
只要输入类型=文本,我就可以使用此插件正常运行代码,但我想使用type = number,以便在移动设备上显示正确的键盘.
有没有办法做到这一点,希望有一些我在文档中遗漏的设置?
这是我的HTML:
<input id="Price" name="Price" type="number" placeholder="0.00" tabindex="3"/>
Run Code Online (Sandbox Code Playgroud)
这是我的js:
$(document).ready(function(){
$('#Price').inputmask("[9][9]9.99", {
numericInput: true,
"placeholder": "0",
showMaskOnHover: false,
greedy: false
});
});
Run Code Online (Sandbox Code Playgroud)