JavaScript/jQuery HTML Encoding
<p>I'm using Javascript to pull a value out from a hidden field and display it on a textbox</p>

<p>The value in the hidden field is encoded.</p>

<p>e.g.</p>

<pre><code>&lt;input id='hiddenId' type='hidden' value='chalk &amp;amp; cheese' /&gt;
</code></pre>

<p>gets pulled into</p>

<pre><code>&lt;input type='text' value='chalk &amp;amp; cheese' /&gt;
</code></pre>

<p>via some JQuery to get the value from the hidden field (Its at this point that I lose the encoding)</p>

<pre><code>$('#hiddenId').attr('value')
</code></pre>

<p>The problem is when I read chalk &amp; cheese from the hidden field, javascript seems to lose the encoding, but to escape " and ' I want the encoding to remain.</p>

<p>Is there a Javascript library or a Jquery method that will Html Encode a string?</p>
