Questions tagged [stoppropagation]

stopPropagation is a method of the event object that prevents further propagation of the current event.

stopPropagation is a method of the event object that prevents further propagation of the current event. This prevents ancestors of the current node from receiving the event.

392 questions
10
votes
4 answers

How do I prevent event propagation on link click?

When I click on my a-tag, I do not want the parent's event to trigger. If the child had a normal event listener, it could be prevented by event.stopPropagation(), but how do I do it when there is no "event"? …
Zebrastian
  • 421
  • 2
  • 7
  • 18
10
votes
7 answers

How to stopPropagation() w/ Hammer.js 2.0?

I have a parent and child div. Panning/dragging on the child should not affect the parent. This is a similar question but was asked a year ago, and I'm using a newer version of Hammer.js w/ the jQuery wrapper. My assumption was that I'd have to…
Eric
  • 101
  • 1
  • 1
  • 5
10
votes
2 answers

Why does preventDefault() on a parent element's click 'disable' a checkbox?

I encountered this situation recently (simplified here). Simply wrap a checkbox with an element and apply preventDefault() on it's click event and the checkbox becomes uncheckable. See this fiddle, but here's a snip:
peteorpeter
  • 4,037
  • 2
  • 29
  • 47
9
votes
3 answers

How to prevent event bubbling in javascript

thanks for reading... I'll get right into the issue. I have an onclick function attached to an image.
Javascript function: function displayCreations(){ …
8
votes
2 answers

stopPropagation in scroll()-Method won't stop outer div from scrolling

I have a inner dev with a fixed height and overflow-y: scroll; where the contents can be scrolled in y direction. When the scrolling hits the top or the bottom the outer div is scrolled. I want to prevent that.
Michael
  • 6,823
  • 11
  • 54
  • 84
8
votes
1 answer

Clicking anywhere on any page of site causes jquery .apply error, why?

I have a few e.stopPropagation() events going on to prevent clicks from bubbling up for certain elements. But now it seems that everytime I click on anything, besides those elements, on these pages, I am getting this error in the console: Uncaught…
Solomon Closson
  • 6,111
  • 14
  • 73
  • 115
8
votes
3 answers

Pros and Cons of using e.stopPropagation() to prevent event bubbling

Many people have explained that e.stopPropagation() prevents event bubbling. However, I'm having a hard time finding why one would want or want to prevent event bubbling in the first place. On my site I have many elements which are called like…
tim peterson
  • 23,653
  • 59
  • 177
  • 299
7
votes
2 answers

ng-change in a checkbox fired more than one time, because an ng-click over it

As a code is better than 1000 words, I've created a plunker in order to show my problem: http://bit.ly/1uiR2wy Given the specific DOM element, thing is that I have an input checkbox with an ng-change, I want to add an ng-click to the li that wraps…
reycoy
  • 145
  • 1
  • 9
7
votes
4 answers

Use stopPropagation in click event

I have an anchor inside a div with class "element". I use the following code to…
arjuncc
  • 3,227
  • 5
  • 42
  • 77
6
votes
5 answers

jQuery stopPropagation()?

Never come across this before can anyone give me any pointers? I'm creating a web app for making notes like post it notes onto a whiteboard. At the moment the spawn button will spawn notes but I want to make it so that the user can click anywhere…
KryptoniteDove
  • 1,278
  • 2
  • 16
  • 31
6
votes
0 answers

Automate react stopPropagation and preventDefault

Using current versions of react-dom and @material-ui, I need to stopPropagation and/or preventDefault in quite a few places. I've never ran into a problem like in this article and I guess, it can't happen because of how Material-UI works: AFAIK open…
maaartinus
  • 44,714
  • 32
  • 161
  • 320
6
votes
1 answer

When is good practice to use stopPropagation()?

There have been some attempts to answer this question: here, here and here. However none of the answers are giving a solid response. I'm not referring to the event phases capture, bubble and target and how stopPropagation() affects the overall…
6
votes
2 answers

d.stopPropagation is not a function on bootstrap select-picker

I have an issue on my site, the select picker works fine a lot of time, but without making any changes on the code, the select-picker stopped working. The error is: bootstrap-select.min.js:7 Uncaught TypeError: d.stopPropagation is not a…
6
votes
2 answers

How to call stopPropagation in Typescript

I'm trying to use stopPropagation method. I use d3.js with d3.d.ts (downloaded via typings). Is it possible to call stopPropagation somehow? I used event.stopPropagation() until I've run my application in firefox. Typings does have d3.event but it…
Julian Rubin
  • 1,175
  • 1
  • 11
  • 23
6
votes
2 answers
1
2
3
26 27