Created
December 23, 2015 22:44
-
-
Save dantheman213/955e08d8f779eefbdcb9 to your computer and use it in GitHub Desktop.
jquery outerhtml
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($){ | |
var div; | |
$.fn.outerHTML = function() { | |
var elem = this[0], | |
tmp; | |
return !elem ? null | |
: typeof ( tmp = elem.outerHTML ) === 'string' ? tmp | |
: ( div = div || $('<div/>') ).html( this.eq(0).clone() ).html(); | |
}; | |
})(jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment