We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

ecavazos on 01/22/08


Tagged

childnodes removechild


Versions (?)


Remove Children From Node


Published in: JavaScript 


  1. function removeChildrenFromNode(node) {
  2. if(node.hasChildNodes()) {
  3. while(node.childNodes.length >= 1 ) {
  4. node.removeChild(node.firstChild);
  5. }
  6. }
  7. }

Report this snippet 

You need to login to post a comment.