The Easy Way to Remove a Child Node
Let’s say you want to remove a node from a Document. Like, for example, a pesky div from its container after an update. Of course, to remove that node from the Document, you’ll have to use the removeChild( ) method of its parentNode. How do you quickly and easily get that reference and wipe out the node?
Here’s a one-liner that works:
document.getElementById('myId').parentNode.removeChild(document.getElementById('myId'));
technorati tags:javascript, node, document, removechild