Remove Children From Node


/ Published in: JavaScript
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.