In addition to being able to access the attributes and styles associated with a node and to be able to replace all child nodes with a text string, we can also perform updates on the node itself. The simplest such update is to delete the node from the web page completely. We do this by calling the removeChild method on the parent of the node to be removed passing the node into the method as a parameter. Removing a node from the page also removes all of the child nodes contained within that node.
This example demonstrates how we can remove a div tag from our web page including whatever is contained within the div.
Note that content added to the web page using innerHTML does not create nodes and so you cannot remove tags from within any content generated using innerHTML through this method. If you want to be able to treat the added content the same way as the existing content then you cannot use innerHTML and must instead use the proper DOM methods.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
<div id="ex">This content ti be removed.</div>
dv = document.getElementById('ex');