[英]Getting the onClickListener registered for an element
Is it possible to get the onClickListener
s registered for an element in a browser DOM?是否可以为浏览器 DOM 中的元素注册onClickListener
?
If yes how does one do that?如果是的话,如何做到这一点?
Are you referring to the method addEventListener()
from DOM interface Event Target
??您是指 DOM 接口Event Target
addEventListener()
方法吗?
This is the syntax这是语法
target.addEventListener(type, listener);
Where target is mostly window
, document
, and an Element ( document.querySelector('#item')
for example )...其中target主要是window
、 document
和 Element (例如document.querySelector('#item')
)...
The type is where you specify the 'click'
representing the event type类型是您指定代表事件类型的'click'
的地方
and the listener is the callback function you will use并且侦听器是您将使用的回调函数
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.