1、
if($('xx').attr('checked') == 'checked'){//true为选中状态
$('#xx').removeAttr('checked');
}else{
$('#xx').attr('checked','checked');
}
2、
if($('#xx').prop('checked')){//true为选中状态
$('#xx').prop('checked',true);
}else{
$('#xx').prop('checked',false);
}