在表单中想对一些行进行操作。可单选,多选,全选,全不选等按钮进行操作。
全选与全不选在同一个按钮上。
总选按钮:
<input type="checkbox" class="checkAll" rel="item" name="allbox" />
子选按钮:
<input type="checkbox" class="child_item" name="box[]" value="<?php echo $v['id'];?>" />
js:
$(document).on("click", ".checkAll", function (e) {
var child = $(this).attr('rel');
$(".child_" + child).prop('checked', $(this).prop("checked"));
});