全选全不选按钮然后点击批量删除
< th >全选 < input type=“checkbox” id=“theadInp” />< /th >
<input name=“ids” class=“ids” type=“checkbox” value="{ {$v.id}}" / >
$(function() {
//实现全选反选
$("#theadInp").on('click', function() {
$("tbody input:checkbox").prop("checked", $(this).prop('checked'));
})
$("tbody input:checkbox").on('click', function() {
//当选中的长度等于checkbox的长度的时候,就让控制全选反选的checkbox设置为选中,否则就为未选中
if($("tbody input:checkbox").length === $("tbody input:checked").length) {
$("#theadInp").prop("checked", true);
} else {
$("#theadInp").prop("checked", false);
}
})
})
function datadel(){
$ids = $("input[name='id