alertify js

What is Alertify JS?

Alertify JS is a JavaScript library that provides an easy way to create responsive and customizable alert, confirm, and prompt dialogs for your web applications. It is a lightweight library that is easy to use and has a small footprint, making it a popular choice among developers.

Why use Alertify JS?

  • Easy to use and customize
  • Responsive design that works on all devices
  • Supports multiple types of dialogs (alert, confirm, prompt)
  • Has built-in themes and customization options
  • Small footprint (less than 5kb minified and gzipped)

How to use Alertify JS?

To use Alertify JS, you first need to include the library in your HTML file. You can download the library from the official website or include it from a CDN:

  <!-- Alertify JS -->
  <link rel="stylesheet" href="[email protected]/dist/css/alertify.min.css" />
  <script src="[email protected]/dist/alertify.min.js"></script>

Once you have included the library, you can use it to create dialogs in your JavaScript code. Here is an example:

// Show an alert dialog
alertify.alert('Hello World!');

// Show a confirm dialog
alertify.confirm('Are you sure?', function(){
}, function(){

// Show a prompt dialog
alertify.prompt('Please enter your name:', function(val, ev){
  // The user clicked "OK"
  alertify.success('You entered: ' + val);
}, function(ev){
  // The user clicked "Cancel"

As you can see, Alertify JS provides a simple and intuitive API for creating dialogs in your web applications.

Customizing Alertify JS

Alertify JS comes with built-in themes and customization options that allow you to customize the look and feel of your dialogs. You can customize the following aspects of the dialogs:

  • Text and button colors
  • Background colors
  • Button labels and icons
  • Dialog size
  • Animation effects

You can customize Alertify JS by creating your own CSS styles or by using one of the built-in themes. Here is an example of how to use a built-in theme:

  <!-- Alertify JS -->
  <link rel="stylesheet" href="[email protected]/dist/css/alertify.min.css" />
  <!-- Alertify JS theme -->
  <link rel="stylesheet" href="[email protected]/dist/css/themes/default.min.css" />
  <script src="[email protected]/dist/alertify.min.js"></script>

By including the theme CSS file after the main CSS file, you can apply a different theme to your dialogs.


Alertify JS is a powerful and easy-to-use JavaScript library that allows you to create responsive and customizable alert, confirm, and prompt dialogs for your web applications. With built-in themes and customization options, you can easily customize the look and feel of your dialogs to match your application's design.

Subscribe to The Poor Coder | Algorithm Solutions

Don’t miss out on the latest issues. Sign up now to get access to the library of members-only issues.
[email protected]