Lightweight Alert & Confirmation Popup Plugin - jQuery Stack Alert

File Size: 7.53 KB
Views Total: 808
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Lightweight Alert & Confirmation Popup Plugin - jQuery Stack Alert

Stack Alert is a lightweight yet customizable jQuery alert plugin to create alert popups and confirmation dialogs for those who need to display error messages or ask for confirmation on web applications.

How to use it:

1. Import the jQuery Stack Alert plugin's JavaScript and Stylesheet.

<link rel="stylesheet" href="/path/to/style.css" />
<script src="/path/to/cdn/jquery.min.js"></script>
<script src="/path/to/cdn/script.js"></script>

2. Create a basic alert popup.

stal({
  title: 'Alert Message',
  text: 'This is an alert message',
  showOkButton: true,
})

3. Create a confirmation dialog using the Promise then() function.

stal({
  title: 'Confirm Dialog',
  text: 'Are you sure to delete?',
  showConfirmButton: true,
  showCancelButton: true,
}).then(function(result) {
  if (result) {
    // confirmed
  } else {
    // rejected
  }
});

4. Available alert types:

  • error
  • warning
  • info
  • success
stal({
  title: 'Confirm Dialog',
  text: 'Are you sure to delete?',
  showConfirmButton: true,
  showCancelButton: true,
  type: 'error',
}).then(function(result) {
  if (result) {
    // confirmed
  } else {
    // rejected
  }
});

This awesome jQuery plugin is developed by mnafullstack. For more Advanced Usages, please check the demo page or visit the official website.