javascript remove html component code example
Example 1: delete element html javascript
function removeElement(elementId) {
// Removes an element from the document.
var element = document. getElementById(elementId);
element. parentNode. removeChild(element);
}
Example 2: delete html with javascript
document.querySelector('selector').remove();