browser dialogs never
looked so good

Fork me on GitHub Native browser dialogs versus alertify.js dialogs

Follow me: fabien-d and @fabien_doiron

The end of maintenance... at least for now

Unfortunately, I will no longer be maintaining alertify.js. I have many ongoing projects that aren't leaving me with enough time to do what needs to be done. If anyone wants to create a fork and maintain - by all means go for it!

It's been great seeing people use it and enjoy it and this decision is simply because I don't believe it's fair that developers are looking for help and not getting it.

I wish I had more time or contributions to keep it going and make it better, but the sad reality is that not usually the case on these kinds of projects.

Forks

I will be updating this site to list forks of alertify.js. At this time none are the official successor, I will leave the community to decide which one should become the main repo. If you have a fork and are interested in taking over alertify.js, please send me a note.

download alertify.js 0.4.0rc1 - deprecated

Source Code (GitHub)

For a stable release of alertify.js, please see alertify.js 0.3.*

features

Customizable look and feel

If you can edit CSS you can customize the look of alertify.js to match your needs

Lightweight, no dependencies

No matter the type of project, if JavaScript is available alertify.js can be used

Growl-like notification

Unobtrusive notification messages can be used to give feedback to users or even as a console.log replacement

Cross-browser and platform

Whether you use a desktop, laptop, tablet or mobile device, alertify.js has you covered

Simple API

From callbacks to handle OK and Cancel actions to customizable properties, using alertify.js is very straightforward
Read full documentation

setup

Inserting into HTML

Include JS

                <!-- ideally at the bottom of the page -->
                <!-- also works in the <head> -->
                <script src="PATH_TO_FILE/alertify.min.js"></script>

Include CSS

                <!-- include the core styles -->
                <link rel="stylesheet" href="PATH_TO_FILE/alertify.css" />
                <!-- include a theme, can be included into the core instead of 2 separate files -->
                <link rel="stylesheet" href="PATH_TO_FILE/alertify.default.css" />

default dialogs

Default dialogs

                        /**
                         * Alertify Alert Dialog
                         *
                         * @param  {String}   Dialog message
                         * @param  {Function} [Optional] Callback after OK
                         * @return {Object}   Dialog Object
                         */
                        Alertify.dialog.alert("Message");

                        // Alertify.dialog can be stored in a variable
                        // var d = Alertify.dialog;
                        // d.alert("Message");

                        /**
                         * Alertify Confirm Dialog
                         *
                         * @param  {String}   Dialog message
                         * @param  {Function} [Optional] Callback after OK
                         * @param  {Function} [Optional] Callback after Cancel
                         * @return {Object}   Dialog Object
                         */
                        Alertify.dialog.confirm("Message", function () {
                            // user clicked "ok"
                        }, function () {
                            // user clicked "cancel"
                        });

                        // Alertify.dialog can be stored in a variable
                        // var d = Alertify.dialog;
                        // d.confirm("Message");

                        /**
                         * Alertify Prompt Dialog
                         *
                         * @param  {String}   Dialog message
                         * @param  {Function} [Optional] Callback after OK
                         * @param  {Function} [Optional] Callback after Cancel
                         * @param  {String}   [Optional] Default placeholder text
                         * @return {Object}   Dialog Object
                         */
                        Alertify.dialog.prompt("Message", function (str) {
                            // str is the input text
                            // user clicked "ok"
                        }, function () {
                            // user clicked "cancel"
                        }, "Default Value");

                        // Alertify.dialog can be stored in a variable
                        // var d = Alertify.dialog;
                        // d.prompt("Message");

default logs

Default Notifications

                        /**
                         * Alertify Log
                         *
                         * @param  {String}   Log type
                         * @param  {String}   Log message
                         * @param  {Number}   [Optional] Delay in ms, 0 means persistent
                         * @return {Object}   Log Object
                         */
                        Alertify.log.create("info", "Notification");

                        // Alertify.log can be stored in a variable
                        // var l = Alertify.log;
                        // l.create("info", "Message");

Info Log

                        /**
                         * Alertify Info Log
                         *
                         * @param  {String}   Log message
                         * @param  {Number}   [Optional] Delay in ms, 0 means persistent
                         * @return {Object}   Log Object
                         */
                        Alertify.log.info("Notification");

                        // Alertify.log can be stored in a variable
                        // var l = Alertify.log;
                        // l.info("Message");

Success Log

                        /**
                         * Alertify Success Log
                         * shorthand for Alertify.log.create("success", "Notification");
                         *
                         * @param  {String}   Log message
                         * @param  {Number}   [Optional] Delay in ms, 0 means persistent
                         * @return {Object}   Log Object
                         */
                        Alertify.log.success("Success notification");

                        // Alertify.log can be stored in a variable
                        // var l = Alertify.log;
                        // l.success("Message");

Error Log

                        /**
                         * Alertify Error Log
                         * shorthand for Alertify.log.create("error", "Notification");
                         *
                         * @param  {String}   Log message
                         * @param  {Number}   [Optional] Delay in ms, 0 means persistent
                         * @return {Object}   Log Object
                         */
                        Alertify.log.error("Error notification");

                        // Alertify.log can be stored in a variable
                        // var l = Alertify.log;
                        // l.error("Message");

Storing Log Element

                        // Storing log element
                        var myLog = Alertify.log.create("custom", "stored notification");
                        // myLog API
                        myLog.close();  // closes the log element
                        myLog.create(); // recreates (doesn't show) the closed log element
                        myLog.show();   // show the recreated log element
                        

                        Alertify.log.info("Hiding in 10 secs", 10000);
                        Alertify.log.info("Will stay until clicked", 0);

                        // Alertify.log can be stored in a variable
                        // var l = Alertify.log;
                        // l.info("Message");

customizable properties

Button Labels

                    // custom OK and Cancel label
                    // default: "OK", "Cancel"
                    Alertify.dialog.labels.ok = "Accept";
                    Alertify.dialog.labels.cancel = "Deny";
                    // button labels will be "Accept" and "Deny"
                    Alertify.dialog.confirm("Message");

Button Focus

                    // which button receives focus
                    // default: "ok"
                    Alertify.dialog.buttonFocus = "cancel"; // "none", "ok", "cancel"
                    // focus will be given to the cancel button
                    Alertify.dialog.confirm("Message");

Button Order

                    // order of the buttons
                    // default: Cancel, OK
                    Alertify.dialog.buttonReverse = true;
                    // buttons order will be OK, Cancel
                    Alertify.dialog.confirm("Message");

custom themes

                    // bootstrap theme
                    // use bootstrap theme CSS
                    // themes/alertify.bootstrap.css
                    Alertify.dialog.prompt("message", ...);