Bootstrap Alter Plugin - Bootstrap

What is alter plugin in Bootstrap?

Alert messages are typically used to show statistics such as warning or confirmation messages to the end users. Using alert message plugin you can add discharge functionality to all alert messages.

If you want to include this plugin functionality individually, then you will need the alert.js. Otherwise, as stated in the section Bootstrap Plugins Summary, you can include the bootstrap.js or the minified bootstrap.min.js.


You can enable discharge of an alert in the subsequent two ways −

  • Through data attributes − to dismiss through Data API just add data-dismiss = "alert" to your close button to automatically give an alert close functionality.

  • Through JavaScript − To terminate through JavaScript use the following syntax –


The next instance shows the use of alert plugin via data attributes.

Alert plugin


Present are no choices here.


The next are some useful methods for alert plugin −





This method wraps all alerts with close functionality.


Close Method.alert('close')

To enable all alerts to be closed, add this method.



The next example shows the use of .alert() method –

alert method


Resulting table lists the events to work with alert plugin. This event may be used to hook into the alert function.




This event fires immediately when thecloseinstance method is called.

$('#myalert').bind('', function () {
 // do something

This event is fired when the alert has been closed (will wait for CSS transitions to complete).

$('#myalert').bind('', function () {
 // do something


The next instance shows the alert plugin events –

Alter plugin events

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Bootstrap Topics