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>&nbsp;'; 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

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -