Skip to content

Instantly share code, notes, and snippets.

@furf
Created April 15, 2009 21:07
Show Gist options
  • Save furf/96020 to your computer and use it in GitHub Desktop.
Save furf/96020 to your computer and use it in GitHub Desktop.
/**
* $.fn.unwrap
* Unwraps an element (replaces an elements parent with the element)
*
* NO LONGER NECESSARY AS OF jQuery 1.4
*
* Example:
* $('#foo').unwrap();
* Will replace:
* <div><span id="foo">bar</span></div>
* with:
* <span id="foo">bar</span>
*/
$.fn.unwrap = function() {
return this.replaceWith(this.html());
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment