jsp页面全选操作

来源:互联网 发布:java array 找众数 编辑:程序博客网 时间:2024/06/05 18:01

//全选操作

操作一:

$(document).on("click","#check_all",function(){     if ($(this).prop("checked")){          $("table.table tbody tr td").children("input[type='checkbox']").prop("checked",true);     }else{         $("table.table tbody tr td").children("input[type='checkbox']").prop("checked",false);     }});<th><input type="checkbox" name="checkbox" id="check_all" autocomplete="off"></th>

//取得全选的左右的值做批量分配

var arr = [];$("input:checkbox:checked[name='checkedId']").each(function(){      arr.push($(this).val());});var checkValues = arr.toString();console.log(checkValues);

操作二:

$(document).on("click","#check_all",function() {if ($(this).prop("checked")) {$("table.table tbody tr td:first-of-type").children("input[type='checkbox']").prop("checked", true);} else {$("table.table tbody tr td:first-of-type").children("input[type='checkbox']").prop("checked", false);}});


0 0
原创粉丝点击