首页 > 编程语言 >How to find event listeners on a DOM node in JavaScript or in debugging?

How to find event listeners on a DOM node in JavaScript or in debugging?

时间:2022-11-20 14:55:21浏览次数:67  
标签:node debugging getEventListeners DOM Chrome element listeners event

How to find event listeners on a DOM node in JavaScript or in debugging?

回答1

Chrome, Firefox, Vivaldi and Safari support getEventListeners(domElement) in their Developer Tools console.

For majority of the debugging purposes, this could be used.

Below is a very good reference to use it:
getEventListeners function


Highly voted tip from Clifford Fajardo from the comments:

getEventListeners($0) will get the event listeners for the element you have focused on in the Chrome dev tools.

评论 TIP: getEventListeners($0) will get the event listeners for the element you have focused on in the Chrome dev tools. I use this all the time. Love not having to use querySelector or get__By_ functions – Clifford Fajardo Jan 31, 2017 at 23:46

 

回答2

 

Update 2022:

In the Chrome Developer Tools, in the Elements panel, there is the Event Listeners tab, where you can see listeners for the element.

You can also unselect "Ancestors" so it only shows the listeners for that element

 

 

 

 

标签:node,debugging,getEventListeners,DOM,Chrome,element,listeners,event
From: https://www.cnblogs.com/chucklu/p/16908479.html

相关文章

  • node-sass与node版本对照图
     长风破浪会有时,直挂云帆济沧海......
  • 虚拟dom和diff算法
    虚拟dom和diff算法1.虚拟dom是一个能代表DOM树的对象,通常含有标签名,标签上的属性、事件监听和子元素们和子元素们的属性2.虚拟dom优点,能减少不必要的DOM操作,能跨平台渲染......
  • Node.js学习随笔
    Node.jsNode.js不是JS,但是和JavaScript的语法非常相似,是一种服务器端技术,他的竞争对手PHP/JAVA/C++/C#/PYTHON-历史上第一次一门语言可以通吃前后端-前端崛起原因之......
  • vue2 echarts 报错 mounted Initialize failed: invalid dom. 的一种解决方法
    如题参考了https://blog.csdn.net/weixin_52418790/article/details/123690752但是还是不行,后来发现我这个是在elementui的模态框里面写的,但是模态框还没有......
  • node 安装配置 及 cnpm 和node 版本不兼容问题
    新电脑回来安装node配置环境 node=>npm=>cnpm=>yarn=>淘宝镜像node下载安装, 一直next到安装成功。刚开始下的16.18的版本,起vue2项目因为node-sass版......
  • Node.js通过密钥计算验证码,无需存数据库
    Node.js通过密钥计算验证码,无需存数据库constCRC32=require('crc-32');functionXixiOtp(sKey,iKeeptime=600){constoPri={};oPri.sKey=sKey;......
  • GKCTF2020-domo
    例行检查全绿,64位保护全开。动态分析增删查改四个功能增删查改改这个功能没太勘定似乎是需要我们输入一个地址去修改,这好像就造成了任意地址写,不太确定,稍后通......
  • DOM_Element对象以及Node对象
    DOM_Element对象Element:元素对象获取/创建:通过document来获取和创建方法:removeAttribute():删除属性setAttribute():添加新属性<body><......
  • DOM_Document对象获取Element方法以及创建DOM对象
    DOM_Document对象获取Element方法Document:文档对象创建(获取):在htmldom模型中使用window对象来获取window.documentdocument方法:......
  • nodejs是什么
    Node.js®是一个开源、跨平台的JavaScript运行时环境。下载https://nodejs.org/dist/v18.12.1/node-v18.12.1-x64.msi在终端打开node-v显示版本号则成功3.......