title: Escape HTML using jQuery
body: <p>I came up with a hack to escape HTML using jQuery and I'm wondering if anyone sees a problem with it.</p>
  
  <pre><code>$('&lt;i&gt;&lt;/i&gt;').text(TEXT_TO_ESCAPE).html();
  </code></pre>
  
  <p>The <code>&lt;i&gt;</code> tag is just a dummy as jQuery needs a container to set the text of.</p>
  
  <p>Is there perhaps an easier way to do this? Note that I need the text stored in a variable, not for display (otherwise I could just call <code>elem.text(TEXT_TO_ESCAPE);</code>).</p>
  
  <p>Thanks!</p>