$.fn.outerHTML = function() {
return (!this.length) ? this: (this[0].outerHTML || (function(el) {
var div = document.createElement('div');
div.appendChild(el.cloneNode(true));
var contents = div.innerHTML;
div = null;
return contents;
})(this[0]));
}
转载请注明:清风亦平凡 » Jquery插件实现outerHTML