Posted By

on 06/29/09


Tagged

javascript remove nodes firstchild


Versions (?)

Removing all child nodes from an element


 / Published in: JavaScript
 

URL: http://matthom.com/archive/2007/05/03/removing-all-child-nodes-from-an-element

  1. var cell = document.getElementById("cell");
  2.  
  3. if ( cell.hasChildNodes() )
  4. {
  5. while ( cell.childNodes.length >= 1 )
  6. {
  7. cell.removeChild( cell.firstChild );
  8. }
  9. }

Report this snippet  

You need to login to post a comment.