I know that getting / setting the cursor position in contentEditable is damned almost impossible. I do not need to know this information. I need to save the current selection, change the innerHTML div and then restore the selection.
I experimented with the answer presented in the content-capable selected save and restore text . It works after entering the div, but not after programmatically , changing the innerHTML div. Instead, when I call restoreSelection, the carriage just jumps to the beginning.
Any suggestions on how to save / restore the selection in contentEditable after changing innerHTML instead of input will be appreciated.
user1022241
source share