如何使用 jQuery 或 Javascript 跳过一个字符并将光标移动到输入中的下一个位置?
您好,如何跳过一个字符并将光标移动到字符串中的下一个位置?例如,在输入字符串 123-4-789
中,当我在 4
和 -
之间插入 5
时应变为 123-45-789
并且光标应位于 -
和 7
之间,而不是 5
和 >-
。因此,如果插入 6
,现在字符串应变为 123-45-6789
。
Hi how to skip a character and move the cursor to the next position in a string? For instance within the input string 123-4-789
, when I insert 5
in between 4
and -
it should become 123-45-789
and the cursor should be between -
and 7
instead of 5
and -
. So if 6
is inserted now string should become 123-45-6789
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许看看 jQuery 的 A-Tools 插件。
基本用法似乎是:
Perhaps have a look at the A-Tools plugin for jQuery.
Basic usage appears to be: