Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
$.outerHTML()
// Cross-browser outerHTML: return it, or if an argument was passed, replace the element.
$.fn.outerHTML = function(arg){
var $el = this;
return arg
? $el.replaceWith(arg)
: $el.clone().wrap('<b>').parent().html();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment