Password validation
Bootstrap 5 Password validation component
Responsive Password validation built with Bootstrap 5. Provide feedback your users whether their password strength is sufficient through password validation.
Basic example
To make a validation element that also displays password requirements:
- use input with
type=password
and div with alert class - Add custom CSS that will add
display: none
for checks and crosses icons - Add JS that:
- a) will make the alert div appear when the input element is in
focus
and disappear when it is not - b) specify the terms of the password
- c) will turn crosses icons into checks if the condition is met and vice versa, and if all conditions are met, it will change the div background and feedback input color
- a) will make the alert div appear when the input element is in
Good
Wrong
- Your password must have at least 8 chars
- Your password must have at least 1 big letter.
- Your password must have at least 1 number.
- Your password must have at least 1 special char.