title: Html/Plain text innertext and special character escape sequence dyamically
body: <p>Am having issue converting  value to text with below inputs</p>
  
  <pre><code>var test = '&lt;html&gt;Weight(lb)&lt;/html&gt;'
  $(test) -- Pass
  
  var test = 'Weight(lb)'
  $(test)   -- fail
  </code></pre>
  
  <p>I know this is related to escape sequence but how could i handle this dynamically because my test variable is dynamic and can have any special characters.</p>
  
  <p>And my next question while this HTML to text conversion happens. is there a better way i can have a common function which converts based on html or plain text. For example</p>
  
  <pre><code>var test = '&lt;html&gt;Weight(lb)&lt;/html&gt;'
  $(test).text() ==&gt;  "Weight(lb)"
  
  var test = 'Weight(lb)'
  $(test).text() ==&gt; ""  expected : "Weight(lb)"
  </code></pre>
  
  <p>what property i can use to get the correct results irrespective of plain or HTML text. am trying to avoid writing an if loop to see id it is html or plain and write cod based on that if possible</p>
  
  <p>Thanks</p>