English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

jQuery event.stopPropagation() Method

jQuery Events

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.

Syntax:

event.stopPropagation();

Example

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 value

parameterdescription
eventtheeventparameters come from the event binding feature

jQuery Events