Created
April 17, 2021 06:42
-
-
Save gaurangrshah/9dae48cfe6394bf1b27ea8b76f5daf21 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* NOT TO BE USED IN PRODUCTION == FOR BROWSER HACKS ONLY */ | |
function removeAllChildNodes(parent) { | |
while (parent.firstChild) { | |
parent.removeChild(parent.firstChild); | |
} | |
} | |
// USAGE: | |
const container = document.querySelector('#container'); | |
removeAllChildNodes(container); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment