destroy html element javascript code example
Example 1: js remove html element
var element = document.getElementById(elementId);
element.parentNode.removeChild(element);
Example 2: delete element html javascript
function removeElement(elementId) {
var element = document. getElementById(elementId);
element. parentNode. removeChild(element);
}
Example 3: element destroy js
var myobj = document.getElementById("demo");
myobj.remove();
Example 4: delete html with javascript
document.querySelector('selector').remove();