how to remove an element by its parentNode code example
Example 1: javascript remove last child element
function remove_last_child() {
var select = document.getElementById('parent_element');
select.removeChild(select.lastChild);
}
Example 2: remove parent element javascript
node.parentNode.parentNode.removeChild(node.parentNode)