javascript中currentTarget属性和target属性之间的确切区别是什么? [英] What is the exact difference between currentTarget property and target property in javascript

查看:122
本文介绍了javascript中currentTarget属性和target属性之间的确切区别是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以告诉我Javascript事件中 currentTarget 目标属性之间的确切区别,并附有示例和属性用于哪种情况?

Can anyone please tell me the exact difference between currentTarget and target property in Javascript events with example and which property is used in which scenario?

推荐答案

基本上,事件泡沫默认情况下,两者之间的区别是:

Basically, events bubble by default so the difference between the two is:


  • 目标是触发事件的元素(例如,用户点击)

  • currentTarget 是元素事件监听器附加到。

  • target is the element that triggered the event (e.g., the user clicked on)
  • currentTarget is the element that the event listener is attached to.

查看关于此博客文章

这篇关于javascript中currentTarget属性和target属性之间的确切区别是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆