3

I'm using jQuery to add a blur event to a text box. I would like my event to fire before any other existing events. Is this possible to do?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Jeremy
  • 44,950
  • 68
  • 206
  • 332
  • see http://stackoverflow.com/questions/2360655/jquery-event-handlers-always-execute-in-order-they-were-bound-any-way-around-th/2641047#2641047 – Anurag Jun 22 '10 at 06:13

2 Answers2

0

Not trivially.

The events are executed in the order they are bound. You could unbind all events, bind yourEvent, then rebind all events though.

Konerak
  • 39,272
  • 12
  • 98
  • 118
0

Do something like this:

var fn = document.GetElementByID('x').clicked;
document.GetElementByID('x').clicked = function(){ 
  //action
  fn();
}

In Javascript the functions are function pointers.

sth
  • 222,467
  • 53
  • 283
  • 367
user368038
  • 265
  • 1
  • 5
  • 16