4
I have this code and would like to switch between true and false the attribute checked input. Strangely is catching the id of label because the web designer superimposed the label at the input.
(function($){
$("label").click(
function(){
var idcheck = $(this).attr("for");
$("input[id="+idcheck+"]").attr("checked", "checked");
}
);
})(jQuery);
As far as I can remember, in jQuery version 1.6 or higher
checkedis treated as property and not as attribute - that is, you get and change with the methodpropand notattr.– Oralista de Sistemas