views:

32

answers:

2

Does jquery/javascript have any event model that you can attach to your objects?

Basically I want an object to have an event, and I want other objects to be able to subscribe to these events?

+1  A: 

You can use the bind function for custom events.

Ross
+3  A: 

Take a look at these:

http://stackoverflow.com/questions/399867/custom-events-in-jquery http://stackoverflow.com/questions/1040963/custom-jquery-event

and here:

http://www.reynoldsftw.com/2009/04/custom-events-in-jquery-open-doors-to-complex-behaviors/

karim79
do you think YUI has a better way to do these things? more efficient?
Blankman
@Blankman - I honestly wouldn't know, as I have never used YUI.
karim79