Prevent any propagation of the same event:
function func1(event) {
alert("DIV 1");
event.stopPropagation();
}
Try it Yourself »
The stopPropagation()
method prevents propagation of the same event from being called.
Propagation means bubbling up to parent elements or capturing down to child elements.
The numbers in the table specify the first browser version that fully supports the method.
Method | |||||
---|---|---|---|---|---|
stopPropagation() | Yes | 9.0 | Yes | Yes | Yes |
event.stopPropagation()
None |
Return Value: | No return value |
---|---|
DOM Version: | DOM Level 3 Events |
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!