[英]enable disable checkbox but not all
I have multiple checkbox i want to disable other checkbox(ie Student
, Parent
, Faculty
) if i select All
but if I select Student
or others the All
checkbox only will be disabled我有多个复选框,如果我选择
All
,我想禁用其他复选框(即Student
、 Parent
、 Faculty
),但如果我选择Student
或其他人,则仅将禁用All
复选框
<input type="checkbox" name="scope[]" value="All">ALL</input>
<input type="checkbox" name="scope[]" value="Student">Student</input>
<input type="checkbox" name="scope[]" value="Parent">Parent</input>
<input type="checkbox" name="scope[]" value="Faculty">Faculty</input>
<input type="checkbox" name="scope[]" value="Others">Others</input>
You can use same name but different ID's to disable your checkbox您可以使用相同的名称但不同的 ID 来禁用您的复选框
<input type="checkbox" name="scope[]" value="All" id="all">ALL</input>
<input type="checkbox" name="scope[]" value="Student" id="student">Student</input>
<input type="checkbox" name="scope[]" value="Parent" id="Parent">Parent</input>
<input type="checkbox" name="scope[]" value="Faculty" id="Faculty">Faculty</input>
<input type="checkbox" name="scope[]" value="Others" id="others">Others</input>
and you can use JavaScript to disable checkbox.并且您可以使用 JavaScript 来禁用复选框。
document.getElementById("others").disabled = true;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.