With ES6 JavaScript it’s easy to remove elements from the DOM. You simply attach the remove() method to the element you want to remove:
let element = document.querySelector("element-to-remove")
element.remove()For example if you want to remove the h1 element from a web page:
let headingOne = document.querySelector("h1")
headingOne.remove()The remove() method is compatible with all modern browsers, including Edge. It’s not compatible with any Internet Explorer browser, including IE11.
Source: Caniuse.com