Skip to content

Instantly share code, notes, and snippets.

@balupton
Created February 1, 2011 09:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balupton/805640 to your computer and use it in GitHub Desktop.
Save balupton/805640 to your computer and use it in GitHub Desktop.
Fetch the outerHTML of an Element
/**
* Fetch the outerHTML of an Element
* @author Benjamin Arthur Lupton
* @license Public Domain
*/
$.fn.outerHtml = $.fn.outerHtml||function(){
var
$el = $(this),
el = $el.get(0),
html = el.outerHTML || new XMLSerializer().serializeToString(el);
return html;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment