문제

How would one print out to console, or iterate for each event listener that is attached to specific DOM element?

I have tried using .eventListenerList but I am getting undefined.

도움이 되었습니까?

해결책

Try,

$('#elem').data('events')

update:

.data(“events”): jQuery stores its event-related data in a data object named (wait for it) events on each element. This is an internal data structure so in 1.8 this will be removed from the user data name space so it won’t conflict with items of the same name. jQuery’s event data can still be accessed via jQuery._data(element, "events") but be aware that this is an internal data structure that is undocumented and should not be modified.

So according to the data from the doc, if you use jquery version > 1.8 then you should follow this method to retrieve informations

$._data($('elem')[0],'events')

DEMO

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top