我想根据 div 标签中包含的复选框是否禁用,将特定类应用于 div。但我无法申请或删除课程。您能否通过指导我如何实现这一目标来帮助我?以下是我的代码:
<p id="parentCheckbox" class="custom-form">
<input class="custom-check" type="checkbox" name="" id="ckbCheckAll">
</p>
<p class="custom-form">
<div class="ez-checkbox">
<input id="" class="custom-check checkBoxClass ez-hide ez-checked" type="checkbox" name="item[]"></input>
</div>
<label>
J2P: Electromagnetic Waves
</label>
</p>
<p class="custom-form">
<div class="ez-checkbox"><input id="" class="custom-check checkBoxClass ez-hide" type="checkbox" disabled="disabled" name="item[]"></input>
</div>
<label>
NEET XII Testlet : Electrostatics 2
</label>
</p>
<p class="custom-form">
<div class="ez-checkbox">
<input id="" class="custom-check checkBoxClass ez-hide" type="checkbox" name="item[]"></input>
</div>
<label>
J2P: Ray Optics & Optical Instruments
</label>
</p>
<p class="custom-form">
<div class="ez-checkbox">
<input id="" class="custom-check checkBoxClass ez-hide" type="checkbox" disabled="disabled" name="item[]"></input>
</div>
<label>
NEET XII Testlet : Electrostatics 2
</label>
</p>
<p class="custom-form">
<div class="ez-checkbox"><input id="" class="custom-check checkBoxClass ez-hide" type="checkbox" name="item[]"></input>
</div>
<label>
J2P: Electromagnetic Waves
</label>
</p>
<p class="custom-form">
<div class="ez-checkbox"><input id="" class="custom-check checkBoxClass ez-hide" type="checkbox" disabled="disabled" name="item[]"></input>
</div>
<label>
NEET XII Test : Electrostatics
</label>
</p>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("#ckbCheckAll").click(function () {
if ($(this).is(':not(:checked)'))
$(".ez-checkbox input:not(:disabled)").removeClass("ez-checked");
if($(this).is(':checked'))
$(".ez-checkbox input:not(:disabled)").addClass("ez-checked");
});
});
</script>
我已经尝试了很多来让这件事发生,但做不到。请帮助我实现它。提前致谢。