how to delete the parent tag in javascript code example
Example 1: how to remove an element from a parent element javascript
function removeElement(el) {
el.parentNode.removeChild(el);
}
// or
HTMLElement.prototype.remove = function() { this.parentNode.removeChild(this); return this; }
Example 2: remove parent element javascript
node.parentNode.parentNode.removeChild(node.parentNode)