> This got me thinking, Yahoo provide a library to handle custom events,
> but at the moment there isn't a jQuery equivalent that I know of.
> I've started wondering how difficult it would be to implement a system
> of custom events on top of the jQuery event system. After reading the
> article I started imagining something like this.
>
> $.event.register ('collapse');
>
> to register a new event, and
>
> $.event.trigger ('collapse');
>
> to fire it.
>
Gordon,
You can already do this in jQuery:
$('#myDiv').bind('myCustomEvent');
...
$.event.trigger('myCustomEvent', [arg1,arg2,arg3]);
The form plugin triggers several custom events like this. For
example, you can bind to its submit notification event like this:
$().bind('form.submit.notify', function(event, $form, options) {
// do something
});
Mike