GaetanNaulin / PopConfirm

A simple action confirmation plugin for jQuery based on Twitter Bootstrap Popover

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

popconfirm

Compatible Bootstrap 2.3 and Bootstrap 3

A simple action confirmation plugin for jQuery based on Twitter Bootstrap Popover

Example

Please, check our simple example here : http://jsfiddle.net/RDh7E/28/

How to use

1: Add the jquery.popconfirm.js file into your Twitter Bootstrap document including jQuery.

  <script type="text/javascript" src="js/jquery.popconfirm.js"></script>

2: Use the jQuery method popConfirm() on any object you want with handle click events :

<a href="mypage.html" id="link">link</a>
$("#link").popConfirm();
<button class="btn btn-success" data-toggle='confirmation' id="button">button</button>
$('#button').click(function() {
    alert('You clicked, and valided this button !');
});

$("#button").popConfirm();

Full options usage

$("[data-toggle='confirmation']").popConfirm({
        title: "Really ?", // The title of the confirm
        content: "I have warned you !", // The message of the confirm
        placement: "bottom", // The placement of the confirm (Top, Right, Bottom, Left)
        container: "body", // The html container
        yesBtn: "Yeah",
        noBtn: "Oh no !!!"
});

You can also pass parameters using the html attribute : data-confirm-* (replace * by the option name).

Example :

<a href="destination.html" data-confirm-title="My Super Title" data-confirm-content="My Super Question">Link</a>

What it handles

  • jQuery .click() and .bind('click') methods
  • Hard coded onclick attributes
  • href attribute from a a lik
  • Submit a form from a type="submit" button/input

About

A simple action confirmation plugin for jQuery based on Twitter Bootstrap Popover

License:MIT License


Languages

Language:JavaScript 50.3%Language:HTML 49.7%