I have a contenteditable
div where I catch certain words and wrap it with a span. And I try to do this while the user is typing.
Currently, I update the html content of the div by jQuery:
$(div).html($(div).html().replace(....))
However, the moment this is run, the cursor position in the div returns to the very first line.
Is there a different method in updating the contents of the contenteditable
without losing the cursor position?