Is there a way (other than the Rangy library) to change the contentEditable Div InnerHTML on the fly, like on a keyboard, without losing the cursor / focus position? I would like to use pure javascript code as much as possible.
eg:
<div id="divId" contentEditable="true" onkeyup="change(this)"></div>
then javascript:
function change(element) { element.innerHTML = element.innerHTML.replace(/.../, '...'); }
Thanks.
source share