web前端|js教程
currentTarget,target
web前端-js教程
event.currentTarget identifies the current target for the event, as the event traverses the DOM. It always refers to the element the event handler has been attached to as opposed to event.target which identifies the element on which the event occurred.
即,event.currentTarget指向事件所绑定的元素,而event.target始终指向事件发生时的元素。翻译的不专业,好拗口啊,还是直接上测试代码吧:
骑士科技源码论坛,Ubuntu音乐太麻烦,爬虫requests怎么下载,php设计模板,潮州seo技巧lzw
click here!
$(‘#wrapper’).click(function(e) {
console.log(‘#wrapper’);
console.log(e.currentTarget);
console.log(e.target);
});
$(‘#inner’).click(function(e) {
console.log(‘#inner’);
console.log(e.currentTarget);
console.log(e.target);
});
/*
以上测试输出如下:
当点击click here!时click会向上冒泡,输出如下:
#inner
click here!
click here!
#wrapper
天空软件站源码,用vscode如何创建模板,ubuntu 无wlan,tomcat 设置内存参数,爬虫 整站图片,php 创建object,seo兼职去哪找外推,织梦网站2个模型lzw
…
click here!
当点击click here!时click会向上冒泡,输出如下:
#wrapper
坐标转换源码,namd ubuntu安装,tomcat内存不足关闭,草地爬虫鱼,php做二次开发,衡阳seo网络营销推广哪家不错lzw
…
…
*/