Empty an element's content
Remove all child nodes of an element from the DOM.
Use the innerHTML
property of an element for removing all child elements, and thus clearing its content:
var el = document.querySelector('div');
el.innerHTML = '';
Event handlers bound to any part of the element's content are destroyed in the process.