Can I find events bound on an element with jQuery?

前端 未结 9 2023
南旧
南旧 2020-11-22 07:11

I bind two event handlers on this link:

Show Alert

JavaScript:

$(         


        
9条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 07:55

    I used something like this if($._data($("a.wine-item-link")[0]).events == null) { ... do something, pretty much bind their event handlers again } to check if my element is bound to any event. It will still say undefined (null) if you have unattached all your event handlers from that element. That is the reason why I am evaluating this in an if expression.

提交回复
热议问题