SyntaxFix
Write A Post
Hire A Developer
Questions
$('#container').clone().wrapAll("<div/>").parent().html();
Update: outerHTML works on firefox now so use the other answer unless you need to support very old versions of firefox