import syeef.com.*;
public class JavaScript {
//

How to remove all child nodes

This example shows how to remove all child nodes from an HTML element:


var parent = document.getElementById("my_element");
while (parent.firstChild) {
    parent.removeChild(parent.firstChild);
}


Or you can do it the old fashioned way:


var parent = document.getElementById("my_element");
parent.innerHTML = "";

}