This script adds a custom confirm dialog with Promise support to your website application. The modal returns a Promise with the selected option: true if the user accepted, false if the user clicked cancel and null if the user closed the modal window.

The modal constructor takes four parameters: the title, the content and the button labels (“Accept” or “Cancel”).

Demo button

Check the console for each button callback.