Created
May 22, 2018 17:20
-
-
Save mthchz/2680f0568ba2d2ce4822b9a8dccd97aa to your computer and use it in GitHub Desktop.
Get outer HTML jQuery/JS
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
/* OuterHtml | |
*******************************************************************************/ | |
if( !$.outerHTML ){ | |
$.extend({ | |
outerHTML: function(ele) { | |
if( ele.length === 1 ) return ele[0].outerHTML; | |
var $return = []; | |
ele.each(function(i) { | |
$return.push($(this)[0].outerHTML); | |
}); | |
return $return; | |
} | |
}); | |
$.fn.extend({ | |
outerHTML: function() { | |
return $.outerHTML($(this)); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment