Customize alert box javascript-alertifyjs

Rakesh Sharma      No Comments  

Customize alert box javascript – alertify.js

Sometime we need to make stylish alert and confirm box in javascript. default browser dialogs never looked so good for make dialogs stylish there are a good library for this. Using this library we can make javascript dialogs stylish. such a good library alertify.js makes your dialogs beautiful. there is simple function to add style to alert and confirm box in javascript named alertify.js.
A simple and easy to use jquery plugin alertify.js makes your dialogs better look for all browsers or cross platforms.

Usage :-

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 (default theme)

	
<!-- include the default theme -->
<link rel="stylesheet" href="PATH_TO_FILE/alertify.css" />

Include CSS (if you’re using Bootstrap)

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

Default Usage :- Default dialogs

	
// alert dialog
alertify.alert("Message");

// confirm dialog
alertify.confirm("Message", function (e) {
    if (e) {
        // user clicked "ok"
    } else {
        // user clicked "cancel"
    }
});

// prompt dialog
alertify.prompt("Message", function (e, str) {
    // str is the input text
    if (e) {
        // user clicked "ok"
    } else {
        // user clicked "cancel"
    }
}, "Default Value");

alert-box

Download CodeLive Demo