--- layout: 'default' hljs: 'light' component: 'alert' title: 'Alert Dialog' prop: '#prop#' propType: '#type#' ---

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.
<%- @partial('ad') %>
Looking for a commercial license ? Keep your source code proprietary and Buy a Commercial License Today!

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'); });
 
<%- @partial('menu', true) %>