jQuery event.target 属性
jQuery 教程
· 2019-03-11 07:28:45
实例
返回哪个 DOM 元素触发了事件:
$("p, button, h1").click(function(event){
$("div").html("通过 " + event.target.nodeName + " 元素触发。");
});
$("div").html("通过 " + event.target.nodeName + " 元素触发。");
});
定义和用法
event.target 属性返回哪个 DOM 元素触发了事件。
这对比较 event.target 和 this 是非常有用的,以便判断事件是否因事件冒泡被处理。
语法
event.target
| 参数 | 描述 |
|---|---|
| event | 必需。event 参数来自事件绑定函数。 |
点击查看所有 jQuery 教程 文章: https://www.codercto.com/courses/l/35.html
PHP&MySQL Web数据库应用开发指南
Hugb E. Williams、David Lane / 谢君英 / 中国电力出版社 / 2003-5 / 69.00元
一起来看看 《PHP&MySQL Web数据库应用开发指南》 这本书的介绍吧!