JS DOM: Remove All Children

By Xah Lee. Date: . Last updated: .

the best way to remove all children is set empty string to innerHTML.

const xx = document.getElementById("ZJDzc");

// remove all children
xx.innerHTML = "";

JS DOM, Insert, Remove