JSFiddle - React, Tailwind, and code Playground
PopConfirm
by Jennifer Perrin
HTML
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css">
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<!-- Simple usage -->
<a href="http://ifnot.github.io/PopConfirm/" class="btn btn-success popconfirm">Simple go to PopConfirm</a>
<!-- Complete usage -->
<button class="btn btn-success popconfirm_full" data-toggle='confirmation' id="important_action">Full featured</button>
CSS
body>a, body>button {
margin: 100px;
}
JavaScript
/*!
* PopConfirm 0.4.5
* http://ifnot.github.io/PopConfirm/
*
* Use jQuery & Bootstrap
* http://jquery.com/
* http://getbootstrap.com/
*
* Copyright 2014 Anael Favre and other contributors
* Released under the MIT license
* https://raw.github.com/AnaelFavre/PopConfirm/master/LICENCE
*
* Thanks to contributors :
* Thomas Hanson https://github.com/diresquirrel
* Mohamed Aymen https://github.com/kernel64
* Muhammad Ubaid Raza https://github.com/mubaidr
*/
(function($) {
'use strict';
/*global jQuery, $*/
/*jslint nomen: true, evil: true*/
$.fn.extend({
popConfirm: function(options) {
var defaults = {
title: 'Confirmation',
content: 'Are you really sure ?',
placement: 'right',
container: 'body',
yesBtn: 'Yes',
noBtn: 'No'
},
last = null;
options = $.extend(defaults, options);
return this.each(function() {
var self = $(this),
arrayActions = [],
arrayDelegatedActions = [],
eventToConfirm,
optName,
optValue,
i,
elmType,
code,
form;
// Load data-* attriutes
for (optName in options) {
if (options.hasOwnProperty(optName)) {
optValue = $(this).attr('data-confirm-' + optName);
if (optValue) {
options[optName] = optValue;
}
}
}
// If there are jquery click events
if (jQuery._data(this, "events") && jQuery._data(this, "events").click) {
// Save all click handlers
for (i = 0; i < jQuery._data(this, "events").click.length; i = i + 1) {
arrayActions.push(jQuery._data(this, "events").click[i].handler);
}
// unbind it to prevent it firing
$(self).unbind("click");
}
// If there are jquery delegated click events
if (self.data('remote') && jQuery._data(document,...