title: How to escape HTML
body: <p>I have a string which contains HTML text. I need to escape just the strings and not tags.
  For example, I have string which contains,</p>
  
  <pre><code>&lt;ul class="main_nav"&gt;
    &lt;li&gt;
      &lt;a class="className1" id="idValue1" tabindex="2"&gt;Test &amp; Sample&lt;/a&gt;
    &lt;/li&gt;
   &lt;li&gt;
    &lt;a class="className2" id="idValue2" tabindex="2"&gt;Test &amp; Sample2&lt;/a&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>How to escape just the text to,</p>
  
  <pre><code>&lt;ul class="main_nav"&gt;
    &lt;li&gt;
      &lt;a class="className1" id="idValue1" tabindex="2"&gt;Test &amp;amp; Sample&lt;/a&gt;
    &lt;/li&gt;
    &lt;li&gt;
      &lt;a class="className2" id="idValue2" tabindex="2"&gt;Test &amp;amp; Sample2&lt;/a&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
  </code></pre>
  
  <p>with out modifying the tags.</p>
  
  <p>Can this be handled with HTML DOM and javascript?</p>