Get and set cursor position with contenteditable div

前端 未结 4 1844
星月不相逢
星月不相逢 2020-12-25 13:58

I have a contenteditable div which I would like to be able to have users insert things such as links, images or YouTube videos. At the moment this is what I have:

4条回答
  •  孤城傲影
    2020-12-25 14:09

    This is what you asked for, in your bounty: on the following example you can see how to detect the exact number of characters of the actual point where you clicked the mouse on:

       
       
    type here some text

提交回复
热议问题