Suppose I am working with HTML code that looks like this:
...
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="invalidCheck">
<label class="form-check-label" for="invalidCheck">
Agree to something
</label>
</div>
<div class="invalid-feedback">
I am located outside of `form-check`!
</div>
</div>
...
I am looking to ensure that the
<div class="invalid-feedback">...
is displayed without the use of JavaScript (relying solely on Bootstrap CSS). While I am aware of classes like was-validated
or is-invalid
, they target elements within the form-check
. Is there a straightforward and effective way to display the invalid-feedback
by utilizing Bootstrap-specific CSS classes?
One approach that I came across involves:
<div class="invalid-feedback d-block">
Now I am visible!
</div>
However, I am uncertain if this solution is optimal. I would appreciate any advice!