While reading an article about Event Pooling with jQuery, I realised that WP has an equivalent system, namely hooks. Here is a little map:
jQuery | WordPress |
---|---|
.bind() | add_action() |
.unbind() | remove_action() |
.trigger() | do_action() |
event.type | current_filter() |
Of course, it’s not a perfect 1:1 match.
WordPress also has filters, besides actions, and a few other functions for controlling both. jQuery, on the other hand, gives you the possibility to bind an event to one or more elements on the page.
The important thing is that if you understand one system, you will easily comprehend the other. I guess this is another reason why jQuery is the prefered library for the WordPress admin.