Bootstrap 4 JS Alert

Alert CSS Classes

For a tutorial about Alerts, read our Bootstrap Alerts Tutorial.
ClassDescriptionExample
.alertCreates an alert message boxTry it
.alert-dangerRed alert. Indicates a dangerous or potentially negative actionTry it
.alert-darkDark alert. Dark grey alert boxTry it
.alert-dismissibleIndicates a closable alert box. Together with the .close class, this class is used to close the alert (adds extra padding)Try it
.alert-headingAdds color:inherit to the specified elementTry it
.alert-infoLight-blue alert.Indicates a neutral informative change or actionTry it
.alert-lightLight alert. Light grey alert boxTry it
.alert-linkUsed on links inside alerts to provide matching colored linksTry it
.alert-primaryBlue alert. Indicates an important actionTry it
.alert-secondaryGrey alert. Indicates a "less" important actionTry it
.alert-successGreen alert. Indicates a successful or positive actionTry it
.alert-warningYellow alert. Indicates caution should be taken with this actionTry it
.closeStyles the close button for the alert message (floats right with a specified font-size, color, etc.)Try it

Close Alerts Via data-* Attributes

Add data-dismiss="alert" to a link or a button element to close the alert message.

Example

<a href="#" class="close" data-dismiss="alert">&times;</a>
Try it Yourself »

Close Alerts Via JavaScript

Close manually with:

Example

$('.close').alert("close");
Try it Yourself »

Alert Options

None

Alert Methods

The following table lists all available alert methods.
MethodDescriptionTry it
.alert("close")Closes the alert messageTry it
.alert("dispose")Destroys an element's alert.

Alert Events

The following table lists all available alert events.
EventDescriptionTry it
close.bs.alertOccurs when the alert message is about to be closedTry it
closed.bs.alertOccurs when the alert message has been closed (will wait for CSS transitions to complete)Try it


Credit: www.w3schools.com
Bootstrap 4 JS Alert Bootstrap 4 JS Alert Reviewed by webmission on 11:39 Rating: 5

No comments:

Powered by Blogger.