removes and returns a child node from the DOM
Description
Removes and returns a child node from the DOM.
The removed child node still exists in memory, but is no longer part of the DOM. It can still be re-used, via the oldChild object reference.
Syntax
var oldChild = element.removeChild(child);
element.removeChild(child);
where,
child is the child node to be removed from the DOM.
element is the parent node of child.
oldChild holds a reference to the removed child node. oldChild === child.
References
- DOM Level 3 Specification - W3C
- Node.removeChild - Document Object Model | MDN