Created
February 25, 2012 22:12
-
-
Save ethertank/1911143 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
function wrapElement(targetElm, wrapperElm) { | |
wrapperElm.appendChild(targetElm.cloneNode(true)); | |
targetElm.parentNode.replaceChild(wrapperElm, targetElm); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment