Removing an element

Remove an element from the DOM tree.


Cross browser safe removal of an element from the DOM tree:

var el = document.querySelector('div'); // select the first returned <div> element 
el.parentNode.removeChild(el);

So, first select the element to remove. Then walk up the tree to its parent and remove the child element from there.


Feedback