I have following code
function kpress(){
document.getElementById("editable").innerHTML = document.getElementById("editable").innerHTML.replace("this","that");
}
<div id="editable" contenteditable="true" style="width:100px;height:100px" onkeypress="kpress()"></div>
Problem is I don't want to replace the old innerHTML with the innerHTML with replace() method instead I want something like this
document.getElementById("editable").innerHTML.replace("this", "that");
Instead of
document.getElementById("editable").innerHTML = document.getElementById("editable").innerHTML.replace("this", "that");