js remove remove and add to the DOM code example
Example 1: javascript remove dom element
var elem = document.querySelector('#some-element');
elem.parentNode.removeChild(elem);
Example 2: javascript remove element from the dom
node.remove();
var elem = document.querySelector('#some-element');
elem.parentNode.removeChild(elem);
node.remove();