I\'m trying to get the HTML of a selected object with jQuery. I am aware of the .html()
function; the issue is that I need the HTML including the selected obje
2014 Edit : The question and this reply are from 2010. At the time, no better solution was widely available. Now, many of the other replies are better : Eric Hu's, or Re Capcha's for example.
This site seems to have a solution for you : jQuery: outerHTML | Yelotofu
jQuery.fn.outerHTML = function(s) {
return s
? this.before(s).remove()
: jQuery("").append(this.eq(0).clone()).html();
};