javascript - How do I handle a mouse event within an element, but not on one of its children? -


i want handle mousedown event 1 way on parent element, handle differently if event occurs on child of parent.

this:

$('.parent').on('mousedown', function(){   //stuff }); 

will fire if element within .parent clicked, want trigger function if parent element element being clicked, not 1 of it's children. how can this?

bind handler child element, , use event.stoppropagation() in child handler. event won't bubble out parent.


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -