JavaScript 'contenteditable' — Getting/Setting Caret Position

后端 未结 6 582
别跟我提以往
别跟我提以往 2021-01-04 04:50

I have read a few posts on positioning the caret, but none seem to answer my particular issue.

  1. I have 2 divs (div1 and div2)<
6条回答
  •  忘掉有多难
    2021-01-04 05:12

    You could insert a tiny span-element at the caret, get its position, and remove it. For a cross-browser range and selection library, see rangy.

提交回复
热议问题