How would I go about removing all of the child elements of a DOM node in JavaScript?
Say I have the following (ugly) HTML:
&
If you use jQuery:
$('#foo').empty();
If you don't:
var foo = document.getElementById('foo'); while (foo.firstChild) foo.removeChild(foo.firstChild);