Jquery – Get value of asp.net CheckBox via jquery(true/false)

asp.netjquery

got the answer syntax error

i want to get value of asp.net check box via jquery , if its selected return true otherwise false. i'm doing this: –

  var ApprovalRequired = $('<%= chkRequired.ClientID %>').is(':checked');
  // also
   var ApprovalRequired = $('<%= chkRequired.ClientID %>').val();

and the checkbox return in html as

  <input id="ctl00_ContentPlaceHolder1_chkRequired" type="checkbox" name="ctl00$ContentPlaceHolder1$chkRequired" checked="checked">

in either way its returning 'false'. Any idea to get true when checked and false on unchecked

Best Answer

You forgot the # in your selector:

$('#<%= chkRequired.ClientID %>').is(':checked');

That should work