jQuery/JavaScript trim HTML that contains white space/empty line
<p>Suppose I have the HTML code as below</p>

<pre><code>&lt;table width="600" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff"&gt;
    &lt;tr&gt;
                    &lt;td&gt;&lt;img src="/images/pho_01.jpg" width="600" height="63" border="none" style="border: 0px;" alt="photo" /&gt;&lt;/td&gt;

                    &lt;td&gt;&lt;/td&gt;


        &lt;td&gt;&lt;/td&gt;
                &lt;/tr&gt;
            &lt;/table&gt;
</code></pre>

<p>The HTML code is not readable, I want to convert to something likes</p>

<pre><code>&lt;table width="600" border="0" cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff"&gt;
&lt;tr&gt;
&lt;td&gt;&lt;img src="/images/pho_01.jpg" width="600" height="63" border="none" style="border: 0px;" alt="photo" /&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
</code></pre>

<p>I have ever used the <a href="http://api.jquery.com/jQuery.trim/" rel="nofollow"><strong>$.trim()</strong></a>, but not works, could someone please suggest a way to <br />
1. remove space(but don't remove the space between attribute likes <code>table width="600"</code>...)<br />
2. remove empty line</p>

<p>Thanks</p>
