Skip to content

Instantly share code, notes, and snippets.

@ethertank
Created February 25, 2012 22:12
Show Gist options
  • Save ethertank/1911143 to your computer and use it in GitHub Desktop.
Save ethertank/1911143 to your computer and use it in GitHub Desktop.
要素を別の要素で包む関数
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