Ant*_*Ant 9 html javascript textbox input
如何在HTML <input>文本框元素中获取所选文本的字符位置?window.getSelection()在文本框中不起作用.
Ulf*_*ack 12
如果您正在使用jQuery,请查看jQuery Caret插件:jCaret
// Get start pos in intput box with id="box1"
$("#box1").caret().start
// Get end pos
$("#box1").caret().end
// Get selected text
$("#box1").caret().text
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
21348 次 |
| 最近记录: |