https://github.com/nikku/jquery-controls
Registration of ajax handlers to bind to certain elements of a page
https://github.com/nikku/jquery-controls
Last synced: over 1 year ago
JSON representation
Registration of ajax handlers to bind to certain elements of a page
- Host: GitHub
- URL: https://github.com/nikku/jquery-controls
- Owner: nikku
- Created: 2011-09-04T08:45:13.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2011-09-04T19:55:26.000Z (almost 15 years ago)
- Last Synced: 2025-03-30T22:32:12.643Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 86.9 KB
- Stars: 22
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
jQuery controls
===============
Small [jQuery](http://jquery.com/) plugin which allows other jQuery plugins to
register custom click controls on page elements.
Features
--------
* Offers `$.fn.controls.bindings` as an entry point for other jQuery plugins to add custom click controls
Requirements
------------
* [jQuery](http://jquery.com/) (tested with jQuery >= 1.4.2 but might work with earlier versions)
Usage
-----
Include requirements and plugin in the header of your website
```html
```
Register controls for a certain element, e.g. a link with `.ajax` as class
```html
$.extend($.fn.controls.bindings, {
"a.ajax": function(event) {
alert("Won't trigger original click: Is an AJAX link!");
event.preventDefault();
}
});
```
Execute `.controls()` on an element to bind all matching triggers to it
```html
// Wait for page load
$(function() {
// Bind to document
$(document).controls();
});
```