create alert component using javascript code example
Example 1: include alert
Alerts are messages to users when something is wrong. For example, if a user types in an incorrect email address or
credit card number, they’ll receive an error alert message, prompting them to make corrections.
.alert-primary
You can create colorful alerts for any texts. Primary alert (more important message) is in light blue color.
Primary alert
.alert-secondary
Add a secondary alert (less important message) in light gray color.
I’m a secondary alert
.alert-success
This will alert a user that their action has been successful
Success alert!
.alert-warning
This will send a message of an upcoming action.
Warning! Warning!
.alert-danger
A danger alert is similar to a warning alert, but for more negative actions (e.g., getting locked out after too many password
fails)
You are in grave danger, my friend!
div>
.alert-link
So you want to add another message and a link to that message in the original alert? You can embed that message and
in the same color.
.alert-dismissible
Provides an option to close the alert after reading it.
.alert-heading
Add a quick header to your alert. (e.g., “shipping address” or “billing address”). It could relate to an entire page or just a
piece of content within that page.
.alert-light and .alert-dark
Changes the alert style to an in either a light or dark gray color.
I’m the light alert
And I’m the dark (side) alert!
Example 2: javascript alert
alert("string");