当前位置:网站首页>Use and description of event delegation
Use and description of event delegation
2022-06-30 09:56:00 【zimingyo】
Event delegation
summary
- advantage : Add an event to the parent element ( Can improve performance )
- principle : Event delegation is actually the use of Event Bubbling Characteristics , Add an event to the parent element , Child elements can trigger
- Realization : Event object .target You can get the true trigger event element
<body>
<ui>
<li> first </li>
<li> the second </li>
<li> Third </li>
</ui>
<script> let ul=document.queryselect('ul') ul.addEventListener('click',function(e){
console.log(e)// obtain Ul All event objects under console.log(e.target)// Get the currently clicked li Elements console.log(e.target.style.color='red')// Click on the current li, send li The color of the color changes to red }) </script>
</body>
边栏推荐
- qmlplugindump executable not found. It is required to generate the qmltypes file for VTK Qml
- Design of mfc+mysql document data management system based on VS2010
- 力扣 428. 序列化和反序列化 N 叉树 DFS
- Cobbler Automated Deployment
- Datatabletomodellist entity class
- Notes on masking and padding in tensorflow keras
- P. Summary of NP, NPC, NP hard and other issues
- Is the jar package for the project or the project for the jar package
- MySQL优化
- prometheus 监控之 ntp_exporter
猜你喜欢

Rider打开Unity脚本后没有提示

7.手机登陆功能开发

【新书推荐】MongoDB Performance Tuning

文章内容无法复制复制不了

Valuenotifier and valuelistenablebuilder in fluent

Differences and relationships among hyper convergence, software defined storage (SDS), distributed storage and server San

Quick completion guide for manipulator (4): reducer of key components of manipulator

MySQL explain

CRF (conditional random field) learning summary

About the smart platform solution for business hall Terminal Desktop System
随机推荐
qmlplugindump executable not found. It is required to generate the qmltypes file for VTK Qml
9.缓存优化
Add / delete query of topic
Practice of super integration and transformation of core production business of public funds
Techtarget: Interpretation of the basic concept of super fusion cloud
目标检测yolov5开源项目调试
Redis + MySQL implements the like function
【JVM】G1垃圾回收器简述
GPT (improving language understanding generative pre training) paper notes
1, 基本配置
How to build an all-in-one database cloud machine that meets the needs of information innovation?
Cftpconnection:: getfile() download FTP server files and related parameter descriptions
【JVM】CMS简述
Application exploration and practice of super convergence in the production environment of insurance industry
Notes on masking and padding in tensorflow keras
鼠标右键打开cmd(命令行)
JUL简介
Good partner for cloud skill improvement, senior brother cloud of Amazon officially opened today
P. Summary of NP, NPC, NP hard and other issues
Flume learning 1