https://github.com/fredwu/jquery-inline-confirmation
Inline Confirmation plugin for jQuery. One of the less obtrusive ways of implementing confirmation dialogues.
https://github.com/fredwu/jquery-inline-confirmation
Last synced: 9 months ago
JSON representation
Inline Confirmation plugin for jQuery. One of the less obtrusive ways of implementing confirmation dialogues.
- Host: GitHub
- URL: https://github.com/fredwu/jquery-inline-confirmation
- Owner: fredwu
- Created: 2010-08-03T05:23:36.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2019-05-06T02:21:29.000Z (about 7 years ago)
- Last Synced: 2025-04-09T05:06:21.546Z (about 1 year ago)
- Language: JavaScript
- Homepage: http://fredwu.me/
- Size: 327 KB
- Stars: 53
- Watchers: 4
- Forks: 8
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Inline Confirmation plugin for jQuery [](http://coderwall.com/fredwu)
In a web app, it is very common to have actions that destroy (delete/remove) data. These actions, if you don’t already know, should always map to POST methods. On top of that, because these actions are destructive, the UI should always ask the user for confirmation.
But how do we actually implement the confirmation dialogue though? The vanilla JavaScript confirm box would be the easiest but at the same time the ugliest - this thing stalls most web browsers until the user acts on it.
An inline popup/modal box? Perhaps, but it is still obtrusive, in the sense that the popup/model boxes are usually in the way of other tasks.
Meet __Inline Confirmation__ - a jQuery plugin for creating easy, less obtrusive confirmation dialogues!
## Configuration
There are a few options to customise the behaviour of this plugin:
Option
Type
Description
confirm
String
The HTML for the confirm action (default: "<a href='#'>Confirm</a>").
cancel
String
The HTML for the cancel action (default: "<a href='#'>Cancel</a>").
separator
String
The HTML for the separator between the confirm and the cancel actions (default: " ").
reverse
Boolean
Revert the confirm and the cancel actions (default: false).
hideOriginalAction
Boolean
Whether or not to hide the original action, useful for display the dialogue as a modal if set to false (default: true).
bindsOnEvent
String
The JavaScript event handler for binding the confirmation action (default: "click").
expiresIn
Integer
Seconds before the confirmation dialogue closes automatically, 0 to disable this feature (default: 0).
confirmCallback
Function
The callback function to execute after the confirm action, accepts the original action object as an argument.
cancelCallback
Function
The callback function to execute after the cancel action, accepts the original action object as an argument.
## Usage
``` js
// using default options
$("a.delete").inlineConfirmation();
// using some custom options
$("a.delete").inlineConfirmation({
confirm: "Yes",
cancel: "No",
separator: " | ",
reverse: true,
bindsOnEvent: "hover",
confirmCallback: function(action) {
action.parent().fadeIn();
}
});
```
## Demo
[Click here for a simple demo](http://fredwu.github.com/jquery-inline-confirmation/).
## Changelog
v1.4.2 [2013-03-07]
- Use jQuery 1.7+'s `on()` instead of the old `live()`
v1.4.1 [2011-07-30]
- Fixed a bug where timeouts aren't being reset correctly.
- Fixed a bug where the click handler executes the default link behaviour.
v1.4.0 [2011-06-28]
- Added a demo and readme to the repository.
v1.3.1 [2010-08-04]
- Fixed a regression bug that causes `expiresIn` to stop working.
v1.3.0 [2010-08-04]
- Removed `allowMultiple` option as tracking multiple instances of the dialogues is not a good idea (the code was broken anyway).
- Added the original action object as an argument to the callback functions.
- Fixed a bug where original actions would disappear.
v1.2.0 [2010-08-04]
- Added `hideOriginalAction` option.
v1.1.0 [2010-08-04]
- Added `allowMultiple` option.
v1.0.0 [2010-08-03]
- Initial release.
## More jQuery Plugins
Check out my other jQuery plugins:
- [Endless Scroll](https://github.com/fredwu/jquery-endless-scroll) - Endless/infinite scrolling/pagination.
- [Slideshow Lite](https://github.com/fredwu/jquery-slideshow-lite) - An extremely lightweight slideshow plugin for jQuery.
## License
Copyright (c) 2010-2012 Fred Wu
Released under the [MIT](http://www.opensource.org/licenses/mit-license.php) license.
[](https://bitdeli.com/free "Bitdeli Badge")