javascript delete first div if second div is called code example Example: remove parent element javascript node.parentNode.parentNode.removeChild(node.parentNode)