我该怎么做?
Replacement of Registration
,请停用Honorable Dismissal
和Entrance Exam
Good Moral Certificate
,请停用Entrace Exam
Honorable Dismissal
,请停用Diploma
,CUE Request
,CMI Request
,Entrance Exam
Transcript of Record
,请停用CUE Request
,CMI Request
,Entrance Exam
Entrance Exam
,请停用所有<input type="checkbox" name="ac_description[]" value="Replacement_of_Registration">
<input type="checkbox" name="ac_description[]" value="Good_Moral_Certificate">
<input type="checkbox" name="ac_description[]" value="Honorable_Dismissal " >
<input type="checkbox" name="ac_description[]" value="Transcript_of_Record">
<input type="checkbox" name="ac_description[]" value="Diploma">
<input type="checkbox" name="ac_description[]" value="CUE_Request">
<input type="checkbox" name="ac_description[]" value="CMI_Request">
<input type="checkbox" name="ac_description[]" value="Entrance_Exam">
<input type="checkbox" name="ac_description[]" value="School_fees-Medical/Dental_Laboratory">
<input type="checkbox" name="ac_description[]" value="School_fees-Transcript/Honorable">
<input type="checkbox" name="ac_description[]" value="School_fees-Library">
<input type="checkbox" name="ac_description[]" value="Affiliation_Fees">
答案 0 :(得分:0)
您将在输入标记的末尾放置禁用,例如:
<input type = "checkbox"name = "ac_description[]" value = "Good_Moral_Certificate" >
<input type = "checkbox" name = "ac_description[]" value = "Honorable_Dismissal " >
<input type = "checkbox" name = "ac_description[]" value = "Transcript_of_Record">
<input type = "checkbox" name = "ac_description[]" value = "Diploma" disabled>
第四个复选框将被禁用。你可以使用jQuery来操作它。 使用jQuery,当触发复选框时,可能会发生事件,它会将disabled属性应用于其他框。 看一下这个答案:Disable/enable an input with jQuery?
如果要禁用组,请为每组输入分配一个类,然后使用jQuery更改它们。看看这篇文章:Catch checked change event of a checkbox
以下是您可能想要尝试的示例:
$('.class_name').each( function(){
$this.onClick( function(){
if( $(this).is(':checked') ){
$('.class_name').each( function(){
if( $(this).not(':checked') ){
$(this).prop('disabled', true);
}
})
}
}) });
答案 1 :(得分:0)
从您的问题中了解了这些代码片段,
$("input[type='checkbox']").click(function(){
var val = $(this).attr('value');
switch(val) {
case 'Replacement_of_Registration':
if($(this).is(':checked'))
$("input[value='Honorable_Dismissal '], input[value='Entrance_Exam']").prop('disabled',true);
else
$("input[value='Honorable_Dismissal '], input[value='Entrance_Exam']").prop('disabled',false);
break;
case 'Good_Moral_Certificate':
if($(this).is(':checked'))
$("input[value='Entrance_Exam']").prop('disabled',true);
else
$("input[value='Entrance_Exam']").prop('disabled',false);
break;
case 'Honorable_Dismissal ':
if($(this).is(':checked'))
$("input[value='Diploma'], input[value='CUE_Request'], input[value='CMI_Request'], input[value='Entrance_Exam']").prop('disabled',true);
else
$("input[value='Diploma'], input[value='CUE_Request'], input[value='CMI_Request'], input[value='Entrance_Exam']").prop('disabled',false);
break;
case 'Transcript_of_Record':
if($(this).is(':checked'))
$("input[value='CUE_Request'], input[value='CMI_Request'], input[value='Entrance_Exam']").prop('disabled',true);
else
$("input[value='CUE_Request'], input[value='CMI_Request'], input[value='Entrance_Exam']").prop('disabled',false);
break;
case 'Entrance_Exam':
if($(this).is(':checked'))
$("input[name='ac_description[]']").not(this).prop('disabled',true);
else
$("input[name='ac_description[]']").not(this).prop('disabled',false);
break;
});