views:

239

answers:

2

is it possible to execute a function in all events

A: 

yes

Darko Z
That's the spirit
jscharf
+1  A: 

To do so, you will most likely have to explicitly specify which events you wish to bind to, unless there is a way to get a list of all event names. Keep in mind different elements have different events as well.

You could do something like this:

eventNames = "click mouseenter keyup keydown etc.."; // all events you wish to bind to

yourFunction = function() { };

$(/* selector for your elements */).bind(eventNames, yourFunction);

Here is the list of possible event values from the jQuery documentation:

blur, focus, load, resize, scroll, unload, beforeunload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error

jscharf