If the second div (id="2") is visibly on top of the first, and it is clicked, You will get both alerts 1 & 2.
How can I avoid this so I only get the alert from what I'm (visibly) clicking on,
Without pletely disabling any onclick function the outer div may possess.
Example: /
How would I stop onclick for an inner element from also clicking through to its parent element.
If the second div (id="2") is visibly on top of the first, and it is clicked, You will get both alerts 1 & 2.
How can I avoid this so I only get the alert from what I'm (visibly) clicking on,
Without pletely disabling any onclick function the outer div may possess.
Example: http://jsfiddle/DPCx8/
javascript
jquery
onclick
parent-child
Share
Improve this question
asked May 11, 2012 at 6:56
d-_-bd-_-b23.2k4343 gold badges171171 silver badges285285 bronze badges