1var myDiv = document.getElementById("myDivID");
2 myDiv.innerHTML = "";//remove all child elements inside of myDiv
1// Get the <ul> element with id="myList"
2let list = document.getElementById("myList");
3
4// As long as <ul> has a child node, remove it
5while (list.hasChildNodes()) {
6 list.removeChild(list.firstChild);
7}