相关疑难解决方法(0)

获取文本输入字段中的光标位置(以字符为单位)

如何从输入字段中获取插入位置?

我通过谷歌发现了一些零碎的东西,但没有任何防弹措施.

基本上像jQuery插件这样的东西是理想的,所以我可以简单地做

$("#myinput").caretPosition()
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

199
推荐指数
7
解决办法
24万
查看次数

selectionStart/selectionEnd输入类型="数字"不再允许在Chrome中使用

我们的应用程序在输入字段上使用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"的输入字段中确定插入符的位置?

javascript google-chrome

73
推荐指数
6
解决办法
4万
查看次数

标签 统计

javascript ×2

google-chrome ×1

html ×1

jquery ×1