I am currently working on validating checkboxes using JavaScript. If the validation fails, I want to display a div
with the class invalid-feedback
below the checkboxes. However, when I add the invalid-feedback
class to my div
, it simply disappears.
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="gridCheck1" oninput="validateCheckbox()">
<label class="form-check-label" for="gridCheck1">
checkbox1
</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="gridCheck2" oninput="validateCheckbox()">
<label class="form-check-label" for="gridCheck2">
Checkbox2
</label>
</div>
<div id="checkboxIdError">I NEED TO ADD THE invalid-feedback CLASS HERE</div>