<input type="checkbox" name="id" value="1" />
<input type="checkbox" name="id" value="2" />
<input type="checkbox" name="id" value="3" />
<input type="checkbox" name="id" value="4" />
<label><input type="checkbox" id="checkAll" name="checkAll" value="all" />全选</label>
$("#checkAll").on("click",function(){
var checkboxObj = $('input[name="id"]');
console.log(checkboxObj);
if($(this).prop("checked")!=false){
checkboxObj.prop("checked",true);
}else{
checkboxObj.prop("checked",false);
}
});