<예시>
<input type="checkbox" id="agree0" name="agree0">전체체크 <br>
<input type="checkbox" id="agree1" name="agree1">체크1
<input type="checkbox" id="agree2" name="agree2">체크2
$("input[name=agree0]").click(function(){
if($("input[name=agree0]").is(":checked")){
$("input[name=agree1]").prop("checked",true);
$("input[name=agree2]").prop("checked",true);
}
else{
$("input[name=agree1]").prop("checked",false);
$("input[name=agree2]").prop("checked",false);
}
});
$("#agree0").click(function(){
if($("#agree0").is(":checked")){
$("#agree1").prop("checked",true);
$("#agree2").prop("checked",true);
}
else{
$("#agree1").prop("checked",false);
$("#agree2").prop("checked",false);
}
});
$("input[name=agree1]").click(function(){
if($("input[name=agree1]").is(":checked") && $("input[name=agree2]").is(":checked")){
$("input[name=agree0]").prop("checked",true);
} else {
$("input[name=agree0]").prop("checked",false);
}
});
$("input[name=agree2]").click(function(){
if($("input[name=agree1]").is(":checked") && $("input[name=agree2]").is(":checked")){
$("input[name=agree0]").prop("checked",true);
} else {
$("input[name=agree0]").prop("checked",false);
}
});
$("#agree1").click(function(){
if($("#agree1").is(":checked") && $("#agree2").is(":checked")){
$("#agree0").prop("checked",true);
} else {
$("#agree0").prop("checked",false);
}
});
$("#agree2").click(function(){
if($("#agree1").is(":checked") && $("#agree2").is(":checked")){
$("#agree0").prop("checked",true);
} else {
$("#agree0").prop("checked",false);
}
});