Deselect contenteditable element

后端 未结 3 443
臣服心动
臣服心动 2021-01-28 15:05

I am trying to remove selection inside a contenteditable field. The code I have is this:

Text

3条回答
  •  庸人自扰
    2021-01-28 15:51

    An answer here solved my problem, but it got deleted for some reason. It was this:

    Replacing $('h1').blur() with window.getSelection().removeAllRanges();" fixed it.

提交回复
热议问题