jQuery: Handling background/container click
Posted
by aximili
on Stack Overflow
See other posts from Stack Overflow
or by aximili
Published on 2010-04-28T00:06:55Z
Indexed on
2010/04/28
0:13 UTC
Read the original article
Hit count: 576
jQuery
I have a big div, and a small button inside the div.
When the div is clicked, I want it to do something.
When the button is clicked, I want it to do something else.
$('#myDiv').click(OnDivClicked);
$('#myButton').click(OnButtonClicked);
Currently when the button is clicked, both OnDivClicked and OnButtonClicked are fired.
How do you prevent OnDivClicked getting fired when the button is clicked?
Thanks in advance.
© Stack Overflow or respective owner