Replace specific word in contenteditable

前端 未结 3 1692
我寻月下人不归
我寻月下人不归 2021-02-08 07:52

I have a contenteditable div

I need to get the last word from caret position and on certai

3条回答
  •  无人共我
    2021-02-08 08:28

    Tobías' solution works well for single-line contenteditable div. But if you add multiple lines, it doesn't work anymore.

    Here is a general solution that works for both single-line or multiline contenteditable div.

提交回复
热议问题