jQuery: Handling background/container click
- by aximili
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.