toTo check a check boxcheckbox you should use this
$('.myCheckbox').attr('checked',true);
or
$('.myCheckbox').attr('checked','checked');
and to uncheck a check box you should always set set it to false:
$('.myCheckbox').attr('checked',false);
ifIf you do this
$('.myCheckbox').removeAttr('checked')
it removes the attribute all together and therefore you will not be able to reset the form.
BAD DEMO jQuery 1.6 i. I think this is broke itbroken. For 1.6 gonnaI am going to make a new post on that.
NEW WORKING DEMO jQuery 1.5.2 this works in chromeChrome.
bothBoth demos use
$('#tc').click(function() {
if ( $('#myCheckbox').attr('checked')) {
$('#myCheckbox').attr('checked', false);
} else {
$('#myCheckbox').attr('checked', 'checked');
}
});