HTML DOM Element remove()
Example
Remove an element from the document:
const element = document.getElementById("demo");
element.remove();
Try it Yourself »
Description
The remove() method removes an element (or node) from the document.
Note
The element or node is removed from the Document Object Model (the DOM).
See Also:
Syntax
element.remove()
or
node.remove()
Parameters
| NONE |
Return Value
| NONE |
Browser Support
element.remove() is a DOM Living Standard feature.
It is supported in all modern browsers:
| Chrome | Edge | Firefox | Safari | Opera |
| Yes | Yes | Yes | Yes | Yes |