jQuery escape characters - square brackets
<p>Does anyone know how to escape the square bracket character in jQuery?</p>

<p>Try the following:</p>

<pre><code>$('#txtFirstname').addClass('test[someval]')
</code></pre>

<p>then</p>

<pre><code>$('#txtFirstname').attr('class')
</code></pre>

<p>you'll see the class is there.</p>

<p>Now try</p>

<pre><code>$('#txtFirstname').hasClass('test[someval]')
</code></pre>

<p>FAIL</p>

<p>The only reason I can think of is the square brackets.</p>

<p>And I need these for my jQuery validation you see.</p>

<p>Any suggestions appreciated</p>

<p>Cheers
Duncan</p>
