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

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -