const parent = document.getElementById("foo") while (parent.firstChild) { parent.firstChild.remove() }