Back
Welcome to Intellipaat Community. Get your technical queries answered by top developers!
If you want to clear the div and remove all child nodes, you can use:
var mydiv = document.getElementById('FirstDiv'); while(mydiv.firstChild) { mydiv.removeChild(mydiv.firstChild); }
var mydiv = document.getElementById('FirstDiv');
while(mydiv.firstChild) {
mydiv.removeChild(mydiv.firstChild);
}
31k questions
32.8k answers
501 comments
693 users