Alert Dialog

An alert dialog is often used if you want to make sure information comes through to the user. When an alert dialog pops up, the user will have to click "OK" to proceed.
Looking for a commercial license ? Keep your source code proprietary and Buy a Commercial License Today!

All of AlertifyJS animation/transition effects are disabled due to user preference that the system minimizes the amount of animation or motion it uses. See prefers-reduced-motion CSS media feature.

Default usage


You create an alert dialog by invoking alertify.alert(...)

Calling alertify.alert() the dialog parameter-less constructor will return the alert dialog instance. You can use this syntax to modify dialog settings before showing it. Also you can get the dialog instance (singletons only) by invoking alertify.dialog('alert');


/*
 * @title {String or DOMElement} The dialog title.
 * @message {String or DOMElement} The dialog contents.
 * @onok {Function} Invoked when the user clicks OK button or closes the dialog.
 *
 * alertify.alert(title, message, onok);
 *
 */
alertify.alert('Alert Title', 'Alert Message!', function(){ alertify.success('Ok'); });

Overloads

For convenience, the following overloads are also available:


/*
 * @message {String or DOMElement} The dialog contents.
 *
 * alertify.alert(message);
 *
 */
 alertify.alert('Alert Message!');

/*
 * @title {String or DOMElement} The dialog title.
 * @message {String or DOMElement} The dialog contents.
 *
 * alertify.alert(title, message);
 *
 */
 alertify.alert('Alert Title', 'Alert Message!');

/*
 * @message {String or DOMElement} The dialog contents.
 * @onok {Function} Invoked when the user clicks OK button or closes the dialog.
 *
 * alertify.alert(message, onok);
 *
 */
 alertify.alert('Alert Message!', function(){ alertify.success('Ok'); });