Can you group jQuery’s events like with switch();?
Something like:
$(element).bind({
blur:
keyup: function(){ /* both do the same stuff */ }
/* Update below */
click: function(){ /* specific stuff */ },
mouseenter: function() { /* more specific stuff */ }
});
You can use the bind method to group jQuery events:
UPDATE
Having read a little more into the bind method since your update, it seems that since jQuery 1.4 we can do exactly what you’re asking for:
Taken from: http://api.jquery.com/bind/#multiple-events
I notice now that it’s not exactly as you’re asking. What you can do is assign the same function to different events but as far as I can tell, there no way to do a direct chaining of events using this method. I tried
bind({click, blur: function(){}})for example and a few other ways but none of them seem to work.