I have a div and when I click, it opens a menu. In that div i have a nested div, and when I click on, it opens the same menu which is also logical.
Now I want when I press the nested div it doesn't open the menu.
How can I do that?
You can bind a click event handler to the inner div and stop the propagation of the event there:
$("#innerDiv").click(function(e) {
e.stopPropagation();
});
That will prevent the event from bubbling up to the parent element, where it would cause the click event handler bound to it to fire.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With