Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

has-danger no longer working on Bootstrap v4 beta?

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/

like image 216
I'll-Be-Back Avatar asked Sep 12 '17 14:09

I'll-Be-Back


People also ask

Can you still use Bootstrap 4?

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.

What changed in Bootstrap 4?

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.

Why is Bootstrap 4 better than Bootstrap 3?

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.

Is Bootstrap deprecated?

In summary, Bootstrap isn't dead. Millions of developers use it. 40,000+ companies use it. It had a major facelift in 2020.


1 Answers

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>
like image 167
I'll-Be-Back Avatar answered Oct 09 '22 21:10

I'll-Be-Back