How to remove Div elements in javascript using their id?

dom, javascript

Solution

You can use `parentNode` on the element to get its parent, and use `removeChild` on it.

var el = document.getElementById( 'id' );
el.parentNode.removeChild( el );

Problem

Possible Duplicate: JavaScript: remove element by id I only know their respective ids and don't know specifically about their parent nodes....

Original source

Related problems