checkbox 全选

$("#selectbox-all").click(function(){//给全选按钮加上点击事件
      var xz = $(this).prop("checked");//判断全选按钮的选中状态

       $("input[type='checkbox'").each(function() {
                    $(this).prop("checked",xz);
        });
})
$.each($('input:checkbox:checked'),function(){
                window.alert("你选了:"+
                    $('input[type=checkbox]:checked').length+"个,其中有:"+$(this).val());
            });

  

原文地址:https://www.cnblogs.com/mmmzh/p/11008705.html