I have a question about checkboxes.
In the linked fiddles, I have 2 checkboxes. If I select both(car, bus) checkboxes, it must also select the “Checkall” checkbox.
Code that toggles the state:
$('.checkAll').change(function() {
$('.chc').attr('checked', $( this ).is( ':checked' ) ? 'checked' :'');
});
Below it works perfect :(with jquery-ui 1.9.1 and jquery 1.4.2)
Demo : http://jsfiddle.net/nUwfB/
But if i remove the jquery 1.4.2 version and add jquery 1.8.3, it doesn’t work:
Demo : http://jsfiddle.net/dSCfp/
The
.attr()method was changed (and no longer works with thecheckedproperty of checkboxes correctly in > v1.6).Use the
.prop()method instead (which accepts a boolean, not a string).Updated non-working fiddle: http://jsfiddle.net/dSCfp/1/