jquery选中checkbox
选中单个checkbox
通过ID或class选择器选中单个checkbox并设置选中状态:
$('#checkboxId').prop('checked', true);
$('.checkboxClass').prop('checked', true);
选中多个checkbox
使用属性选择器选中所有checkbox:

$('input[type="checkbox"]').prop('checked', true);
根据条件选中checkbox
结合filter方法实现条件筛选:

$('input[type="checkbox"]').filter(function() {
return $(this).val() === 'option1';
}).prop('checked', true);
反选checkbox状态
使用prop方法获取当前状态并取反:
$('#checkboxId').prop('checked', function(i, current) {
return !current;
});
获取选中的checkbox
使用:checked选择器获取所有已选中的checkbox:
var checkedBoxes = $('input[type="checkbox"]:checked');






