JQUERY 全选

$(".CheckBoxAll :checkbox").click(function() {
    $(".CheckBoxItem :checkbox").attr("checked", $(this).attr("checked"));
});
$(".CheckBoxItem :checkbox").click(function() {
    var flag = $(".CheckBoxItem :checkbox").length == $(".CheckBoxItem :checked").length;
    $(".CheckBoxAll :checkbox").attr("checked", flag);
});
原文地址:https://www.cnblogs.com/jgjgjg23/p/2348745.html