我有两个复选框,我的方案是“如果选中第一个复选框,则允许用户选中第二个复选框,否则不应选中第二个复选框。” 完成试演
</td>
</tr>
<tr>
<td style="width: 30%" align="right" class="label" nowrap="noWrap" valign="top">
Audition Approved
</td>
<td style="width: 70%" align="left" class="label" nowrap="noWrap" valign="top">
<asp:CheckBox ID="chkAuditionApproved" onclick="checkboxCheck();" runat="server" />
</td>
</tr>
答案 0 :(得分:0)
$(function () {
$("#chkAuditionApproved").click(function () {
if ($(this).is(":checked")) {
$("#chkbox2").removeAttr("disabled");
$("#chkbox2").focus();
} else {
$('#chkbox2').prop('checked', false);
$("#chkbox2").attr("disabled", "disabled");
}
});
});
&#13;
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"></script>
<input type="checkbox" id="chkAuditionApproved" />
<input type="checkbox" id="chkbox2" disabled="disabled" />
&#13;