In this section, we will learn what the remove() method is and how to use it in JavaScript.
What is Element remove() Method in JavaScript?
The JavaScript Element remove() method is used to remove the element that invoked this method from the DOM.
Note: invoking this method will remove the target element as well as its entire children (if any).
JavaScript remove() Method Syntax:
node.remove();
JavaScript remove() Method Parameter
The method does not take an argument.
JavaScript remove() Method Return Value
The method does not return a value.
Example: JavaScript remove/delete element from DOM
See the Pen JavaScript remove/delete element from DOM by Omid Dehghan (@odchan1) on CodePen.