How to list all registered events of a DOM node using JavaScript?

前端 未结 7 2796
臣服心动
臣服心动 2021-02-19 16:50

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 mea

7条回答
  •  感情败类
    2021-02-19 17:11

    Also, in Google Chrome, please select the element and notice the number, it will show you $0 or any other number.

    Then in console, type this code and press enter.

    getEventListeners($0)
    

    and then you will see the result. Please see the image below for more elaboration.

提交回复
热议问题