title: How to remove white space between html tags using javascript?
body: <p>I have some HTML content inside a JavaScript variable:</p>
  
  <pre><code>var string="&lt;tr&gt;  &lt;td&gt; data 1 &lt;/td&gt; &lt;td&gt; data 2 &lt;/td&gt;   &lt;td&gt; data 3 &lt;/td&gt;&lt;/tr&gt;";
  </code></pre>
  
  <p>I want to remove the white spaces between HTML tags only. The White space in column data must be remain same.</p>
  
  <pre><code>string.replace(/\n/g, "");
  string.replace(/[\t ]+\&lt;/g, "&lt;");
  string.replace(/\&gt;[\t ]+\&lt;/g, "&gt;&lt;");
  string.replace(/\&gt;[\t ]+$/g, "&gt;");
  </code></pre>
  
  <p>I tried the above code. But this is not worked. Some one please help me to solve this problem.</p>