Created
June 28, 2016 11:25
-
-
Save andreasvirkus/307c23096e79313ab4f09f4aadd40110 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
// vanilla | |
var el = document.getElementById("foo"), child = el.firstChild, nextChild; | |
while (child) { | |
nextChild = child.nextSibling; | |
if (child.nodeType == 3) { | |
el.removeChild(child); | |
} | |
child = nextChild; | |
} | |
// jQuery | |
$("#foo").html($("#foo").children()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment