Is there a way ( except Rangy library ) to change contentEditable Div InnerHTML on the fly, like on keyup, with no cursor position / focus lose? I'd like to use pure javascript code, as simple as it is possible.
for example :
<div id="divId" contentEditable="true" onkeyup="change(this)"></div>
then javascript :
function change(element)
{
element.innerHTML = element.innerHTML.replace(/.../, '...');
}
Thanks.
This doesn't use the keyup event but perhaps it will suffice? Note that applies to the body you can obviously target just a certain element.
If you're replacing the HTML, you will need some means of saving and restoring your selection. The options are: