我有一个应用程序窗体,其中它作为单选按钮来选择其中一个选项。我必须禁用一个未选中的单选按钮。 例如,如果表格包含2科目作为科学和商业,并且它还包含 选修科目如计算机科学和生物科学和数学和商业研究商务。如果我的选择是科学,我需要启用科学下的选修课并禁用商业下的选修课。如果我的选择是商业,我需要启用商业下的选修课程。 请电话我,我怎么能做到这一点启用和禁用单选按钮
这里是代码
$(function() {
$("#XISubmit").click(function(){
var XISubject = XIForm.find('input[name=XISubject]:checked').val();
if (XISubject == null || XISubject == "") {
alert("Please select the Study Streams Offered");
return false;
}
$("#XIScience").click(function(){
$(".science").attr('disabled','disabled');
$(".commerce").removeAttr('disabled');
});
document.getElementById("XIForm").submit();
});
<div class="sbold sleft"><input type="radio" name='XISubject' value='Science' id="XIScience"/> Science</div>
<div class="sbold sright"><input type='radio' name='XISubject' value='Commerce' id="XICommerce"/> Commerce</div>
<div class="sleft"> English Physics Chemistry Maths</div>
<div class="sright">English Accounts Commerce Economics</div>
<br>
<label>37(a).If your choice of <b>Subject Stream(ques.37)</b> is Science select one of the two electives below:</li>
<br>
<div class="sleft"><input type='radio' name='XIElectives' value='Biology' id="XIBiology" class="science"/> Biology</div>
<div class="sright"><input type='radio' name='XIElectives' value='Computer Science' id="XICS" class="science"/> Computer Science</div>
<br>
<label>37(b).If your choice of <b>Subject Stream(ques.37)</b> is Commerce select one of the two electives below:
</label>
<br>
<div class="sleft"><input type='radio' name='XIElectives' value='Mathematics' id="XIMathematics" class="commerce"/> Mathematics</div>
<div class="sright"><input type='radio' name='XIElectives' value='Business Studies' id="XIBS" class="commerce"/> Business Studies</div>
<br>
语法错误在你的行$(“科学).attr(‘禁用’,真正的); - 请关闭双引号” .science”,然后尝试.. – kameswarib