Escape single quotes in Jquery or Javascript
<p>I want to display the following text for the <code>&lt;span&gt;</code> tag. How do I escape the single quotes for this </p>

<pre><code>$("#spn_err").text($('#txt1').attr('value')+" is not valid");
</code></pre>

<p>I want to display the message as '<code>ZZZ' is not valid</code>. Here <code>$('#txt1').attr('value')</code> is dynamic value it may have <code>abc</code>, <code>bcc</code>, <code>ddd</code>, <code>zzz</code>. How can I do this?</p>
