Allert.js | Building Pretty Clean Alert Notification With JavaScript

Allert.js is a minimal, clean JavaScript notification library, we can use it to build some toast-like alert and notification messages on the web application.

Allert.js - Building Pretty Clean Alert Notification With JavaScript

AuthorLinksMade withLast update
philippesilvaOffice HomeJavaScriptSep 15, 2022

How to use build a pretty and clean alter notification using Allert.js?

1.Download and insert the allert js and css file in your html page

<link rel="stylesheet" href="allert.css">
<script src="allert.js"></script>

2.Create a default alert message box

allert('Alert Message Here');

3.You also can add a custom icon for the alert message using icon

allert('Alert Message Here', {
  icon: "fa fa-check" // uses Font Awesome
});

4.You also can change the alert notifaction type using type attribution

  // or warning, danger, info
  type: 'success'
  
});

5. You also can set the duration of the notification in ms. Default: 2 seconds.

allert('Alert Message Here', {
  'duration': '5000'
});

6.You also can set a container to append an alert notification by using container-id attribution

allert('Alert Message Here', {
  'container-id': 'body'
});

Leave a Reply

Your email address will not be published. Required fields are marked *