Easy Alert/Confirm Modal In JavaScript – acModal

Category: Javascript , Modal & Popup | March 19, 2020
Author: Remi-Leclercq-Blondel
Views Total: 390 views
Official Page: Go to website
Last Update: March 19, 2020
License: MIT

Preview:

Easy Alert/Confirm Modal In JavaScript – acModal

Description:

acModal is an easy, responsive, pretty clean modal plugin to replace the native window alert() & confirm().

How to use it:

1. Install & download the plugin.

# NPM
$ npm install ac-modal --save

2. Insert the main JavaScript file into the document.

<script src="./build/index.js"></script>

3. Create a custom alert modal.

acModal.alert({
  title: 'Alert Title',
  message: 'Alert Message',
  buttonCallBack: function () {
    // fired after the OK button is clicked.
  },
  buttonText: 'Ok',
  appendTo: null // where to append the alert modal
});

4. Create a custom confirm dialog.

acModal.confirm({
  title: 'Confirm Title',
  message: 'Confirm Message',
  successCallBack: function () {
    // fired after the OK button is clicked.
  },
  successText: 'OK',
  cancelCallBack: function () {
    // fired after the Cancel button is clicked.
  },
  cancelText: 'Cancel',
  appendTo: null // where to append the alert modal
});

You Might Be Interested In:


Leave a Reply