5

If multiple event handlers are attached to same event on the same elements, in which order are they executed?

I have had a look at this which is more specific to click event. this says that standards do not specify anything about order.

So, my question is, in what order events are executed? (that event can be any event may be synchronous or asynchronous)

Community
  • 1
  • 1
hrishikeshp19
  • 8,288
  • 23
  • 75
  • 139

1 Answers1

2

As best I can tell through empirical testing, the click event handlers are executed in the order they were attached to the object. The first one attached is the first one to execute.

Here's a test bed that I ran in Chrome, Firefox, IE9 and Safari and they all executed the event handlers in the order they were initially attached.

Working test bed: http://jsfiddle.net/jfriend00/yTYxV/

jfriend00
  • 637,040
  • 88
  • 896
  • 906