title: javascript escape HTML within code tag
body: <p>basically I need to be able to search for tags "&lt;" and ">" within a &lt;code&gt; block and have them set as TEXT rather than HTML, so that I can display all tags and HTML on the page.</p>
  
  <p>At the moment all tags are coming through as actual HTML on the page when I do a string replace using jQuery:</p>
  
  <pre><code>var text = $("#edit").val();
  filter = text.replace(/&lt;/gi,"&amp;lt;").replace(/&gt;/gi,"&amp;gt;");
  $("#output").html(filter);
  </code></pre>
  
  <p>I cant change html() to text() because any HTML, OUTSIDE the  block is fine. I'm basically looking for something very similar as to how this textbox / code tag idea works on stackoverflow. </p>
  
  <p>Is there an easy way to do this using JavaScript / jQuery?</p>
  
  <p>Thanks</p>