//Select all button processing
$(function(){
//Click to select all
$("#checkAll").click(function () {//When clicking on the select all box
var flag = $("#checkAll").is(" :checked"); // Determine the status of the select all button
var checkItems=document.getElementsByName("checkItem");
for(var i=0;i checkItems[i].checked = flag;
}
});
//Click on the sub-item
$("input:checkbox[name='checkItem']").each(function( ){
$(this).click(function(){
if($("input:checkbox[name='checkItem']:checked").length==$("input:checkbox[name ='checkItem']").length){
document.getElementById("checkAll").checked = true;
}else{
document.getElementById("checkAll").checked = false;
}
});
});
});