jQuery event.stopImmediatePropagation() 方法
jQuery 教程
· 2019-03-11 06:58:17
实例
执行第一个事件处理程序,并阻止剩下的事件处理程序被执行:
$("div").click(function(event){
alert("事件句柄 1 被执行");
event.stopImmediatePropagation();
});
$("div").click(function(event){
alert("事件句柄 2 被执行");
});
$("div").click(function(event){
alert("事件句柄 3 被执行");
});
alert("事件句柄 1 被执行");
event.stopImmediatePropagation();
});
$("div").click(function(event){
alert("事件句柄 2 被执行");
});
$("div").click(function(event){
alert("事件句柄 3 被执行");
});
定义和用法
event.stopImmediatePropagation() 方法阻止剩下的事件处理程序被执行。
该方法阻止事件在 DOM 树中向上冒泡。
提示:请使用 event.isImmediatePropagationStopped() 方法来检查指定的事件上是否调用了该方法。
语法
event.stopImmediatePropagation()
| 参数 | 描述 |
|---|---|
| event | 必需。event 参数来自事件绑定函数。 |
点击查看所有 jQuery 教程 文章: https://www.codercto.com/courses/l/35.html
Domain-Driven Design
Eric Evans / Addison-Wesley Professional / 2003-8-30 / USD 74.99
"Eric Evans has written a fantastic book on how you can make the design of your software match your mental model of the problem domain you are addressing. "His book is very compatible with XP. It is n......一起来看看 《Domain-Driven Design》 这本书的介绍吧!