Last active
September 13, 2016 20:52
-
-
Save airton/05c258d1fa50f208cb6a686f4db87117 to your computer and use it in GitHub Desktop.
This file contains 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
// select element to unwrap | |
var el = document.querySelector('div'); | |
// get the element's parent node | |
var parent = el.parentNode; | |
// move all children out of the element | |
while (el.firstChild) parent.insertBefore(el.firstChild, el); | |
// remove the empty element | |
parent.removeChild(el); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment