As I have stated before, JQuery is an extremely powerful tool. One of the most under-discovered (but extremely useful) features of JQuery is extend-able event binding. There are several events that are backed into the JQuery framework, but you can create, bind, and trigger your own JQuery events very easily.
Custom Event Trigger
The code below is all it takes to trigger your own custom event. You can bind to this custom event and raise it whenever you want to execute the code inside of the bind.
Custom Event Binding
The code below creates a bind to the custom event and will be executed whenever the custom event is triggered.
That’s all there is to it! JQuery custom events are extremely useful. How do you plan to use custom events in your code?