Skip to main content Accessibility Feedback

DOM Injection

Node.remove()

Remove an element from the DOM. Call the Node.remove() method on the element you want to remove.

<h1>Hello, world!</h1>
let h1 = document.querySelector('h1');
h1.remove();