Confirm User Intentions With A Beautiful Confirmation Dialog

Category: Javascript , Modal & Popup | January 13, 2022
Author:Xn1ch1
Views Total:495 views
Official Page:Go to website
Last Update:January 13, 2022
License:MIT

Preview:

Confirm User Intentions With A Beautiful Confirmation Dialog

Description:

Just another confirmation dialog popup library used to confirm user intentions on the web app.

How to use it:

1. Add the stylesheet ConfirmDialogue.css and JavaScript ConfirmDialogue.js to the webpage.

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

2. Create a new confirmation dialog with the following parameters:

  • trueButtonText: Confirm button text
  • falseButtonText: Refuse button text
  • cancelButtonText: Cancel button text
  • messageText: Confirm messages
  • titleText: Confirm title
const dialogue = new ConfirmDialogue({
      trueButtonText: "Yes",
      falseButtonText: "No",
      cancelButtonText: 'Cancel',
      messageText: "This one has another option, the cancel option for when you dont want to do anything",
      titleText: "More Buttons"
});

3. Do something if confirmed.

if (await dialogue.respond()) {
  alert('You pressed yes');
} else {
  alert('You pressed no');
};

Changelog:

01/13/2022

  • JS & CSS updated

You Might Be Interested In:


Leave a Reply