Get contentEditable caret index position

后端 未结 10 695
暗喜
暗喜 2020-11-22 05:48

I\'m finding tons of good, crossbrowser anwers on how to SET the cursor or caret index position in a contentEditable element, but none on how to GET or find its

10条回答
  •  抹茶落季
    2020-11-22 06:21

    Try this:

    Caret.js Get caret postion and offset from text field

    https://github.com/ichord/Caret.js

    demo: http://ichord.github.com/Caret.js

提交回复
热议问题