English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
the event.stopPropagation() method to stop the event bubble to the parent element, thus preventing any parent event handler from being executed.
Usingevent.isPropagationStopped();method.
You can check if this method has been called before (on the event object) in ourJavaScript Event PropagationLearn more about event propagation in the tutorial.
event.stopPropagation();
In the following example, if you click on a child element, the click event listener on the parent element will not be executed:
$("div, p, a").click(function() { event.stopPropagation(); alert("You clicked: ", " "); + this.tagName); });Test and see‹/›
parameter | description |
---|---|
event | theeventparameters come from the event binding feature |