0
<body>
<input type="checkbox" id="chkMain" />
<input type="checkbox" id="chkMain1" />
<input type="checkbox" id="chkMain2" />
<br>
<P><input class="child" type="checkbox" id="chk1" disabled="true" />
<input class="child" type="checkbox" id="chk" disabled="true" />
<input class="child" type="checkbox" id="chk" disabled="true" />
<input class="child" type="checkbox" id="chk" disabled="true" />
<input class="child" type="checkbox" id="chk" disabled="true" />
<input class="child" type="checkbox" id="chk" disabled="true" />
<input class="child" type="checkbox" id="chk_all" disabled="true" />ALL</p></br>
$(function(){
$("input[id^=chkMain]").click(function(){
var otherCks = $("input[id^=chkMain]").not(this);
if(!$(this).is(":checked")) {
$(".child").attr("disabled" , true);
otherCks.removeAttr ("disabled");
}
else {
$(".child").removeAttr ("disabled");
otherCks.attr("disabled" , true)
}
});
});
在這裏我想啓用所有兒童checkboxex點擊「所有」chkbox – Harshil 2011-01-11 17:04:53
我很困惑,你的「全部」複選框被禁用。這似乎沒有道理。 – JasCav 2011-01-11 17:09:50