How to order events bound with jQuery

后端 未结 12 1292
闹比i
闹比i 2020-11-22 13:09

Lets say I have a web app which has a page that may contain 4 script blocks - the script I write may be found in one of those blocks, but I do not know which one, that is ha

12条回答
  •  广开言路
    2020-11-22 13:24

    In some special cases, when you cannot change how the click events are bound (event bindings are made from others' codes), and you can change the HTML element, here is a possible solution (warning: this is not the recommended way to bind events, other developers may murder you for this):

    Button
    

    With this way of binding, your event hander will be added first, so it will be executed first.

提交回复
热议问题