How would I go about removing all of the child elements of a DOM node in JavaScript?
Say I have the following (ugly) HTML:
&
let el = document.querySelector('#el'); if (el.hasChildNodes()) { el.childNodes.forEach(child => el.removeChild(child)); }