Skip to content

Instantly share code, notes, and snippets.

View yuvaltobias's full-sized avatar

Yuval Tobias yuvaltobias

View GitHub Profile
@yuvaltobias
yuvaltobias / behaviors.js
Created July 11, 2011 16:37 — forked from jamis/behaviors.js
Behavior-registration for UJS with jQuery
// An Unobtrusive Javascript (UJS) driver based on explicit behavior definitions. Just
// put a "data-behaviors" attribute on your view elements, and then assign callbacks
// for those named behaviors via $.Behaviors.add.
$.Behaviors = {
add: function(trigger, behavior, handler) {
$('[data-behaviors~=' + behavior + ']').live(trigger, handler);
}
};