这对我
<input type="checkbox" id="chkMain" /><br
<input class="child" type="checkbox" id="chk1" disabled="true" />
<input class="child" type="checkbox" id="chk2" disabled="true" />
<input class="child" type="checkbox" id="chk3" disabled="true" />
<input class="child" type="checkbox" id="chk4" disabled="true" />
<input class="child" type="checkbox" id="chk5" disabled="true" />
$(function(){
$("#chkMain").click (function() {
if (!$(this).is (":checked"))
{
$(".child").attr ("disabled" , true);
}
else
{
$(".child").removeAttr ("disabled");
}
});
});
Working Demo
工作正常,如果您可以张贴HTML还那么这将是更有帮助。
非常感谢!这正是我正在寻找的... – Shruti 2009-10-30 06:34:25