<div>
<h1>Invoer normaal</h1>
<div class="md-form">
<label for="input-example1">E-mailadres</label>
<input type="text" id="input-example1" class="form-control" placeholder="e-mail">
<div class="invalid-feedback">
<span class="sr-only">Invoer onjuist: </span>Het e-mailadres is onjuist
</div>
<div class="valid-feedback">
<span class="sr-only">Invoer juist: </span>Het e-mailadres is juist
</div>
</div>
</div>
<div>
<h1>Invoer juist</h1>
<div class="md-form">
<label for="input-example2">E-mailadres</label>
<input type="text" id="input-example2" class="form-control is-valid" placeholder="e-mail" value="juist@email.nl">
<div class="invalid-feedback">
<span class="sr-only">Invoer onjuist: </span>Het e-mailadres is onjuist
</div>
<div class="valid-feedback">
<span class="sr-only">Invoer juist: </span>Het e-mailadres is juist
</div>
</div>
</div>
<div>
<h1>Invoer onjuist</h1>
<div class="md-form">
<label for="input-example3">E-mailadres</label>
<input type="text" id="input-example3" class="form-control is-invalid" placeholder="e-mail" value="dit-is-geen-e-mail">
<div class="invalid-feedback">
<span class="sr-only">Invoer onjuist: </span>Het e-mailadres is onjuist
</div>
<div class="valid-feedback">
<span class="sr-only">Invoer juist: </span>Het e-mailadres is juist
</div>
</div>
</div>
<div>
<h1>Invoer inactief</h1>
<div class="md-form">
<label for="input-example4">E-mailadres</label>
<input type="text" id="input-example4" class="form-control" placeholder="e-mail" disabled>
<div class="invalid-feedback">
<span class="sr-only">Invoer onjuist: </span>Het e-mailadres is onjuist
</div>
<div class="valid-feedback">
<span class="sr-only">Invoer juist: </span>Het e-mailadres is juist
</div>
</div>
</div>
Based on the version from MDB:
https://mdbootstrap.com/components/inputs/
No additional actions, aside from the markup, are needed to use this component.
for
attribute on the label element and the corresponding id
on the input elementis-invalid
class on the input elementis-valid
class on the input elementvalid-feedback
and invalid-feedback
divs can be omitted. Leaving out the invalid-feedback
is discouraged because a screen reader user doesn’t see the red line beneath the input when the input is invalid.