How to list all registered events of a DOM node us

2020-07-04 07:57发布

I can add or remove an event handler for a DOM node. Is it possible to find out all the registered events handlers of a given DOM node? I am referring to straight Javascript meaning no frameworks or toolkits like jQuery, dojo, Prototype, GWT, etc. If the answer is no, any reason why? Security issues?

7条回答
Luminary・发光体
2楼-- · 2020-07-04 08:34

This works for Chrome/Safari console:

getEventListeners(document.getElementByID('myElementId'));
查看更多
登录 后发表回答