Compatible Bootstrap 2.3 and Bootstrap 3
A simple action confirmation plugin for jQuery based on Twitter Bootstrap Popover
Please, check our simple example here : http://jsfiddle.net/RDh7E/28/
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();
$("[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>
- jQuery
.click()
and.bind('click')
methods - Hard coded
onclick
attributes href
attribute from aa
lik- Submit a form from a
type="submit"
button/input