According to the Bootstrap migration guide:
Renamed .has-error to .has-danger.
However, that doesn't seem to work. Border and text has not been coloured.
For example:
<div class="form-group has-danger">
<label class="form-control-label" for="inputDanger1">Input with danger</label>
<input type="text" class="form-control form-control-danger" id="inputDanger1">
<div class="form-control-feedback">Sorry, that username's taken. Try another?</div>
<small class="form-text text-muted">Example help text that remains unchanged.</small>
</div>
Demo:
https://jsfiddle.net/uLa0spfm/
Bootstrap Versions The main differences between Bootstrap 5 and Bootstrap 3 & 4, is that Bootstrap 5 has switched to JavaScript instead of jQuery. Note: Bootstrap 3 and Bootstrap 4 is still supported by the team for critical bugfixes and documentation changes, and it is perfectly safe to continue to use them.
With Bootstrap version 4, an improvement has been made to make it a 5 grid tier system, xs, sm, md, lg, and xl. The new grid tier, xl, extends the media query range all the way down to 544px. The improved grid system also offers the following: Support for flexbox in the grid mixins and predefined classes.
While Bootstrap 3 provided Skip navigation, Nested headings, and color contrast, Bootstrap 4 has improved the accessibility with its components. Styling and layout from version 4 can be applied to a wide range of markup structures.
In summary, Bootstrap isn't dead. Millions of developers use it. 40,000+ companies use it. It had a major facelift in 2020.
Managed to get it to work. @ZimSystem is correct about this.
.has-danger
exist in Alpha version but it was removed in Bootstrap v4 Beta. You will need to use is-invalid
selector in the input and also include class="invalid-feedback"
for error message.
Here is example:
<div class="form-group has-danger">
<label class="form-control-label">Username</label>
<input type="text" class="form-control is-invalid">
<div class="invalid-feedback">Sorry, that username's taken. Try another?</div>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With