Possible Duplicate:
Get selected element's outer HTML
I have this code :
<html>
<head></head>
<body></body>
</html>
and with $('html').html() I only get :
<head></head>
<body></body>
how can I get the whole code? I mean, with also the parent of the element where I use .html()…
Bit of a hack:
Might be slow in older browsers with a lot of HTML on the page, because it has to clone the whole thing.
Edit: If you want a jQuery function which does it, just write one:
Then just call
$('html').outerHtml().