Removing an element
jQuery $.remove(), $.detach()
2015 page
This is the original page from 2015, kept at its address while the tested rewrite is in progress. The code is of its time: it ran in Internet Explorer and does not use what browsers have gained since. The rewrite replaces it here.
In short
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.