title: How to strip html tags in string then escape the plain string and put the escaped string into html tags back
body: <p>I wanted to strip html tags then escape plain string and put back the escaped string back into html tags , for that i have tried : </p>
  
  <pre><code>var aa = "&lt;p&gt;hi testing &amp; &lt;/p&gt;";
  var bb = $(aa).text();
  var cc = escape(bb);
  var dd = aa.replace(bb, cc);
  </code></pre>
  
  <p>dd gives me the output <code>"&lt;p&gt;hi%20testing%20%26&lt;/p&gt;"</code> , but the problem is when i have multiple html tags in string  for eg: <code>aa ="&lt;p&gt;hi testing &amp; &lt;/p&gt;&lt;p&gt; failed &amp; &lt;/p&gt;"</code> its not working.</p>
  
  <p>Please help.</p>
  
  <p>Thanks in advance.   </p>