我有很多复选框,95.它们都具有相同的类并被命名为数组。我需要将课程从bg-primary更改为bg-success或其他颜色。我最后还需要说'你错过了这个复选框'。这是我在现在切换CheckBoxes类和验证类
<h3 class = "col-lg-12 text-center bg-warning "><a href="#">STEP 5 - Under the hood</a></h3>
<div id= "acc4">
<form>
<fieldset class="form-horizontal form-group bg-primary">
<input type="checkbox" class="box " name="checkBox[]" id="78">Check oil condition and level
</fieldset>
<fieldset class="form-horizontal form-group bg-primary">
<input type="checkbox" class="box " name="checkBox[]" id="79">Check coolant condition and level
</fieldset>
<fieldset class="form-horizontal form-group bg-primary">
<input type="checkbox" class="box " name="checkBox[]" id="80">Check trans fluid condition and level
</fieldset>
<fieldset class="form-horizontal form-group bg-primary">
<input type="checkbox" class="box " name="checkBox[]" id="81">Check power steering fluid condition and level
</fieldset>
<fieldset class="form-horizontal form-group bg-primary">
<input type="checkbox" class="box " name="checkBox[]" id="82">Check brake fluid condition and level
</fieldset>
<fieldset class="form-horizontal form-group bg-primary">
<input type="checkbox" class="box " name="checkBox[]" id="83">Fill washer fluid resevoir
</fieldset>
<fieldset class="form-horizontal form-group bg-primary">
<input type="checkbox" class="box " name="checkBox[]" id="84">Battery hold down
</fieldset>
<fieldset class="form-horizontal form-group bg-primary">
<input type="checkbox" class="box " name="checkBox[]" id="85">Check battery & charging system
</fieldset>
<fieldset class="form-horizontal form-group bg-primary">
<input type="checkbox" class="box " name="checkBox[]" id="86">Inspeect belts
</fieldset>
这里,我使用失败是
$('input[type=checkbox]').on('change', function() {
$(this).toggleClass('form-horizontal form-group bg-warning', this.checked);
});
是的,先生未选中的。那部分工作得很好..现在我该如何创建一个错过的数组? – Griehle