elementparentNoderemoveChildelement
elementparentNoderemoveChildelement refers to the common DOM operation of removing a child element from its parent node. In the Document Object Model, every element is a Node, and the parentNode property identifies the node that contains a given node. The removeChild method is defined on the Node interface and removes a specified child node from the parent, detaching it from the DOM and returning the removed node.
Usage typically involves a reference to the parent and the child. For example:
var parent = document.getElementById('parent');
var child = document.getElementById('child');
This can also be invoked via the child’s reference:
child.parentNode.removeChild(child);
If the node passed to removeChild is not a child of the specified parent, a DOM exception
Modern browsers also support Element.remove(), a convenience method that removes the element itself from the DOM
Related concepts include the parentNode and parentElement properties, and other DOM manipulation methods such as insertBefore