What is the execution order of inline events, attachEvent handlers, and an <a> tag's href navigation?
Asked
Active
Viewed 1,200 times
0
SLaks
- 868,454
- 176
- 1,908
- 1,964
lovespring
- 19,051
- 42
- 103
- 153
2 Answers
2
The execution order of individual event handlers is undefined.
If none of the event handlers called e.preventDefault(), and if onclick didn't return false, a navigation will occur.
SLaks
- 868,454
- 176
- 1,908
- 1,964
-
I always thought tags event had priority over binded ones. – Ben May 21 '10 at 03:04
-
If using `attachEvent`, this implies IE, which means the event will have no `preventDefault` method. The equivalent is `e.returnValue = false;`. – Tim Down May 21 '10 at 08:25
-1
Try it yourself: http://jsfiddle.net/rhJ2f/
Ben
- 16,275
- 9
- 45
- 63
-
1even the tag event return false, the binded handler still exec! thanks. – lovespring May 21 '10 at 03:07