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() + ",";
}
});
});

posted @ 2022-01-20 17:32  双手插在裤兜谁也不爱  阅读(774)  评论(0)    收藏  举报