Deleting a DOM Element with Javascript

You can use the Node.remove() method to delete a DOM element with Javascript.

for example

<h1>PHPEXAMPLE.NET</h1>
<h2>PHPEXAMPLE.NET</h2>

Here to delete <h1> tag you will use like this.

let h1 = document.querySelector('h1')
h1.remove()

You have now deleted the <h1> tag in the DOM.

Comments

There are no comments, make the firs comment