title: Get HTML String for jQuery and/or DOM object
body: <p>I think I've read through the complete <a href="http://api.jquery.com/" rel="nofollow">jQuery API documentation</a> and looked at jQuery objects and simple DOM elements in the debugger to check what methods they actually have at runtime, but for the life of me, I can't find a way to get the html string that represents the contents of a jQuery object or a DOM Node. Am I missing something?</p>
  
  <p>jQuery objects have the method <code>html()</code>, DOM elements have the property <code>innerHTML</code> but both only give the inner html of the object. So if I have HTML like this:</p>
  
  <pre><code>&lt;body&gt;
      &lt;div&gt;
          &lt;p&gt;Hello World!&lt;/p&gt;
      &lt;/div&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p>And I use jQuery doing something like this <code>var $div = $body.find("div")</code> and I then call <code>$div.html()</code> the returned string is <code>"&lt;p&gt;Hello World!&lt;/p&gt;"</code>. But I'm looking for a way to make it return <code>"&lt;div&gt;&lt;p&gt;Hello World!&lt;/p&gt;&lt;/div&gt;"</code> (I don't care about the whitespace).</p>
  
  <p>What am I doing wrong? It can't be that difficult to get the html representation of these objects, can it?</p>