javascript delete node code example
Example 1: javascript remove dom element
var elem = document.querySelector('#some-element');
elem.parentNode.removeChild(elem);
Example 2: Removing DOM nodes when traversing a NodeList
NodeList nodes = ...;
for (int i = nodes.getLength() - 1; i >= 0; i--) {
Element e = (Element)nodes.item(i);
if (certain criteria involving Element e) {
e.getParentNode().removeChild(e);
}
}