Skip to content Skip to sidebar Skip to footer

How Do You Move The Cursor To The Next Element In A Contenteditable Div In Chrome/safari?

I have logic to insert a tag in a contenteditable div. I want to set the cursor to the start of the following element after the insertion. The code I have to do this is: function

Solution 1:

This is a long-standing and annoying bug in WebKit. See also the bug for the special case of placing the caret inside an empty inline element, which has more activity. There's not a lot you can do about it, unless inserting and selecting a single zero-width space character is acceptable.

Solution 2:

You have to give contentEditable={false} to the element you inserted :

<divcontentEditable={true}><spancontenEditable={false>/span>
</div>

Post a Comment for "How Do You Move The Cursor To The Next Element In A Contenteditable Div In Chrome/safari?"