Possible Duplicate:
How all events of dom element can be bind?
I have an object that gets events triggered against it.
How do I bind all the events and console.log the event name?
Possible Duplicate:
How all events of dom element can be bind?
I have an object that gets events triggered against it.
How do I bind all the events and console.log the event name?
You can bind all the standard javascript events by including them in the bind call separated by spaces. The jQuery docs provide this list:
blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error
So, to bind the event for click, blur and focus:
$('#foo').bind('click blur focus', function(event) {
console.log(event.type);
});
If you're looking for custom events, you'll have to look at the API and bind those as well. There doesn't appear to be any way to bind on any event.