8

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

1
  • 3
    also $('#<%= chkRequired.ClientID %>').prop('checked'); Commented May 2, 2013 at 18:23

1 Answer 1

20

You forgot the # in your selector:

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

That should work

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.