Rich Text Browser Alert & Confirm Dialog – alert4html.js

Category: Javascript , Modal & Popup | March 31, 2021
Author: ColonelParrot
Views Total: 158 views
Official Page: Go to website
Last Update: March 31, 2021
License: MIT

Preview:

Rich Text Browser Alert & Confirm Dialog – alert4html.js

Description:

alert4html.js is an alternative to the browser alert/confirm dialog that enables you to create rich text alert & confirm dialog boxes on the page.

See Also:

How to use it:

1. Import the alert4html.js JavaScript library and we’re ready to go.

<script src="/src/script.min.js"></script>

2. Create a basic alert dialog.

new HTMLAlert('Alert!','<h1>A Basic Alert Dialog</h1>'

3. Create a custom confirm dialog with buttons and a callback function.

buttons = {
  "cheese": {
    type: "proceed",
    content: "Okay"
  },
  "idk": {
    type: "cancel",
    content: "Thanks"
  }
}
callback = function(content, type){
  console.log("You chose "+content);
  alert.destroy();
}
alert = new HTMLAlert('Confirm Dialog', "<h1>Are You Sure?</h1><b>Click The Okay Button To Delete This Entry</b>", buttons, callback);

You Might Be Interested In:


Leave a Reply