开发者

Add event to top of event stack using jQuery

开发者 https://www.devze.com 2023-01-01 04:42 出处:网络
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?Not trivially.

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?


Not trivially.

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


Do something like this:

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

In Javascript the functions are function pointers.

0

精彩评论

暂无评论...
验证码 换一张
取 消