Created
December 2, 2017 21:53
-
-
Save webbower/e0843ccb4262be1ffe5498933db80d80 to your computer and use it in GitHub Desktop.
Remove all children from a DOM node
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
// https://stackoverflow.com/a/3955238/2684520 | |
const emptyNode = (el) => { | |
while (el.lastChild) { | |
el.removeChild(el.lastChild); | |
} | |
return el; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment