一旦选中其中一个,我需要禁用具有相同类的其余复选框。
$('.Cat .RoleChk').change(function(){
if($(this).is(':checked')){
$('.Cat .RoleChk').attr('disabled',true);
$(this).attr('disabled','');
}
else{
$('.Cat .RoleChk').attr('disabled','');
}
});
<div class="Cat" style="width: 155px; float: left">
<p>Employee Role</p>
<input class="RoleChk" name="Role" type="checkbox" value="OfficeEmployee"/> Office Employee<br/>
<input class="RoleChk" name="Role" type="checkbox" value="Marketer"/> Marketer<br/>
<input class="RoleChk" name="Role" type="checkbox" value="ProjectManager"/> Project Manager<br/>
</div>
<div class="Cat" style="width: 155px; float: left">
<p>Groups</p>
<input class="GrpChk" name="Group" type="checkbox" value="Aviation"/> Aviation<br/>
<input class="GrpChk" name="Group" type="checkbox" value="Electrical"/> Electrical<br/>
<input class="GrpChk" name="Group" type="checkbox" value="Mining"/> Mining
</div>