Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.
i have a problem with checkboxes , even if i change -- check = "unchecked"
Use prop() not attr() for this as attr() will not work in newer versions of jquery. Do jquery uncheck checkbox -
$('#myCheckbox').prop('checked', false);
this will change the value:
$("#theChk").prop("checked",true)
this will get you the value:
$("#theChk").prop("checked") or $("#theChk").attr("checked")
However, you cannot trust the .attr() method to get the value of the checkbox (if you need to). You will have to rely in the .prop() method.
So, for jQuery 1.6+
Use the new .prop() function as:
$('#myCheckbox').prop('checked', true); // Checks it $('#myCheckbox').prop('checked', false); // Unchecks it