View on GitHub

jquery.confirm

Confirm dialogs for buttons and links

Download this project as a .zip file Download this project as a tar.gz file

Demo

Link (reload this page) with a simple confirmation:

Click me

Customized confirmation dialog:

Requirements

If you use Bootstrap 2, you can use any 1.* version. From 2.* and onwards, Bootstrap 3 is required.

Usage

Download and include jquery.confirm in your head tags:

<script src="js/jquery.confirm.js"></script>

Write your links (also works for buttons):

<a href="home" class="confirm">Go to home</a>

Enable the confirmation dialogs:

$(".confirm").confirm();

Any click on the link will pop up a dialog asking the user to confirm the action.

Options

List of the options:

Example:

<button class="confirm" type="button">Delete the comment</button>

$(".confirm").confirm({
    text: "Are you sure you want to delete that comment?",
    title: "Confirmation required",
    confirm: function(button) {
        // do something
    },
    cancel: function(button) {
        // do something
    },
    confirmButton: "Yes I am",
    cancelButton: "No",
    post: true
});

Manual triggering

You can manually trigger the confirmation dialog:

$.confirm({
    text: "Are you sure you want to delete that comment?",
    confirm: function(button) {
        // do something
    },
    cancel: function(button) {
        // do something
    }
});

Global configuration

You can configure some options globally, for example if you translate the messages:

$.confirm.options = {
    text: "Are you sure?",
    title: "",
    confirmButton: "Yes",
    cancelButton: "Cancel",
    post: false
}

Change log