title: Converting html table to string using jquery
body: <p>I've got some html in a string and I need to extract a table from it. So, for example, my htmlString variable contains (:</p>
  
  <pre><code>&lt;html&gt;&lt;head&gt;....some head stuff&lt;/head&gt;&lt;body&gt;&lt;table&gt;.... some table stuff&lt;/table&gt;.... other body stuff&lt;/body&gt;&lt;/html&gt;
  </code></pre>
  
  <p>So, what I have tried is the following:
  (typed, not copied, so there may be typos)</p>
  
  <p>var table       = $( '' ).append( htmlString ).find( 'table' ).get();</p>
  
  <p>If I view my table variable, I do see:</p>
  
  <pre><code>[&lt;table&gt;...&lt;/table&gt;]
  </code></pre>
  
  <p>so, I believe I am extracting the table from the html string correctly.</p>
  
  <p>Now, to convert this back to a string, I do the following:</p>
  
  <pre><code>var tableString = $( table[0] ).html();
  </code></pre>
  
  <p>and I get back:</p>
  
  <pre><code>&lt;tbody&gt; ... the table stuff ... &lt;/tbody&gt;
  </code></pre>
  
  <p>but, what I want is:</p>
  
  <pre><code>&lt;table&gt; ... the table stuff ... &lt;/table&gt;
  </code></pre>
  
  <p>How can I do this?</p>