Get all child nodes javascript -
hi trying add html space after in contenteditable div; problem that, above code return content of first div , ignore else.
var tdiv = document.createelement('div'); tdiv.innerhtml = '<div>testing html</div> '; var replacment = tdiv.firstchild; // el.insertnode(replacment); // purpose, "el" html element
with nbsp removed.
if want children of tdiv
added el
try
var el = document.getelementbyid('x') while (tdiv.firstchild) { el.appendchild(tdiv.firstchild); }
demo: fiddle
Comments
Post a Comment