Skip to main content
Figuration v4.3 is now available!

Bring interactivity to your site with a selection of jQuery widgets (plugins) all built with accessibility and usability in mind.


Enable dismiss functionality for alert messages.

Page Contents


<div class="alert alert-warning" role="alert">
<strong>Warning!</strong> Objects in the mirror are closer than they appear.
<button type="button" class="close" data-cfw-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>

<div class="alert alert-danger" role="alert">
<h4>Oops! You got an error!</h4>
<p>Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.</p>
<button type="button" class="btn btn-danger">Take this action</button>
<button type="button" class="btn btn-secondary" data-cfw-dismiss="alert">Close</button>

The dismiss will work with dynamically inserted alerts.


Via Data Attributes

Just add data-cfw-dismiss="alert" to a close button inside the alert container to automatically give an alert close functionality.

Via JavaScript

Enable dismissal of an alert via JavaScript:



Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-cfw-alert, as in data-cfw-alert-animate="false".

Name Type Default Description
target string null The selector (jQuery style) of the target item to be dismissed.
animate boolean true If alert targets should fade out.



Activates the element as a dismiss trigger. (Not necessary when using the Figuration widget API is enabled.) Accepts an optional options object.

animate: false


Closes an alert.


Removes the click event listener from a trigger. This will not disable a dismiss item if the Figuration widget API is enabled.


Event callbacks happen on the target alert container.

Event Type Description
beforeClose.cfw.alert This event is fired immediately when the close method is called.
afterClose.cfw.alert This event is fired when an alert has been closed (will wait for CSS transitions to complete).
$('#myAlert').on('beforeClose.cfw.alert', function () {
// do something...