// Select the parent element const parent = document.getElementById('parentElementId'); // While the parent has child nodes, remove the first one while (parent.firstChild) { parent.removeChild(parent.firstChild); }
// Select the parent element const parent = document.getElementById('parentElementId'); // While the parent has child nodes, remove the first one while (parent.firstChild) { parent.removeChild(parent.firstChild); }