Why this works
document.getElementById("myCheckbox").checked = false;
whereas this doesn’t with jquery:
$("myCheckbox").attr("checked") = false;
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are a couple of things wrong with your code. First of all, you select elements in jQuery using selectors, just like in CSS. So you need to turn this
into this, using the hash (
#) for ID selectorSecondly, jQuery doesn’t really use properties, but methods for everything. Pass one parameter to get a value, two to set it. In this case, you also want to be using
propand notattr. So you would need to do:Live example