Remove all children of a node

1. Empty the inner HTML (not recommended)

ele.innerHTML = '';

This method isn't recommended because it doesn't remove event handlers of child node. Hence, it might cause a memory leak if you are managing a big list of elements.

2. Remove child nodes

Remove its child node until it doesn't have any children.

while (node.firstChild) {
node.removeChild(node.firstChild);
}

More

Previous
Put cursor at the end of an input
Next
Resize an image