title: How to remove all html tags from a string
body: <p>Hi I am trying to remove all the html tags from a particular string its showing error.</p>
  
  <p>Here is my string:</p>
  
  <pre><code>&lt;p&gt;Hi there&lt;/p&gt; ~ wifi free &lt;p&gt;this is test&lt;/p&gt; ~ breakfast free &lt;p&gt;This is another test&lt;/p&gt;
  </code></pre>
  
  <p>My jQuery code is here:</p>
  
  <pre><code>var item = &lt;p&gt;Hi there&lt;/p&gt; ~ wifi free &lt;p&gt;this is test&lt;/p&gt; ~ breakfast free &lt;p&gt;This is another test&lt;/p&gt;;
  item = item.replace(/~/g, '');
  item = item.replace(/&lt;p&gt;/g, '');
  item = item.replace('&lt;/p&gt;'/g, '');
  var splitArray = item.split('&lt;br /&gt;');
  var l = splitArray.length;
  for (var i = 0; i &lt; l; i++) {
      out = out + "&lt;li&gt;&lt;span class='sp_icon sp_star_icon'&gt;&lt;/span&gt; "
            + splitArray[i].trim() + "&lt;/li&gt;";
  }
  console.log(item);
  </code></pre>