jQuery .val() problems getting and setting
<p>I have been using jQuery for a while and this makes no sense to me.  Can anyone explain why this is happening?  I have a hidden field , <code>&lt;asp:HiddenField ID="hidIsValid" runat="server" /&gt;</code>  and I have this code assigning a value to it.</p>

<p>This took me hours to decide to try to change the way I set the value , and now it works , but it appears this is the wrong way:</p>

<pre><code>  $('#&lt;%= hidIsValid.ClientID %&gt;').val("true");  **This line never worked
  $('#&lt;%= hidIsValid.ClientID %&gt;').val() = "true";  **this line does work
</code></pre>

<p>I comes from here , I took out a lot of the code ,this is just ot show the pertinent lines.</p>

<pre><code>      function fnValidateAttendees() {
       // $('#&lt;%= hidIsValid.ClientID %&gt;').val("true");  **This line never worked
        $('#&lt;%= hidIsValid.ClientID %&gt;').val() = "true";            
        $('.tFirstName, .tLastName').each(function () {
            if (!($(this).val().match(/^[a-z -']+$/))) {                    
                $('#&lt;%= hidIsValid.ClientID %&gt;').val("false"); //**this line works
            }              
        });
        $('.tPhoneNumber').each(function () {
            if (!($(this).val().match(/^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/))) {                   
                $('#&lt;%= hidIsValid.ClientID %&gt;').val("false"); //**this line works
            }
        });
        $('.tEmail').each(function () {
            if (!($(this).val().match(/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$/))) {
                $('#&lt;%= hidIsValid.ClientID %&gt;').val("false"); //this line works
            }
        });
        return true;
    }        
</code></pre>

<p>can someone make sense of this</p>
