JQuery Checkbox 获取多选值 Checkbox选中个数

1、获取checkbox选中个数

$("input[name='ckb-jobid']:checked").length
$("input[type='checkbox']:checked").length;

2、获取选中的值

//批量处理
$('#batchUpdate').on("click", function () {
    var str = "";
    $("input[name='ckb-jobid']:checked").each(function (index, item) {
        
        if ($("input[name='ckb-jobid']:checked").length-1==index) {
            str += $(this).val();
        } else {
            str += $(this).val() + ",";
        }  
    });
});
原文地址:https://www.cnblogs.com/youmingkuang/p/10000856.html