does it stop the inner function call, hope I am clearing it while clicking on div with class ‘one’ myFun should trigger within that function need to stop the display() function call.
Sorry I don’t understand what you are asking, if the event in .two calls event.stopPropagation() it prevents the event from “bubbling up” to the parent .one and triggering that event.
myFun() should call eihter click of any class(.one, .two), but if I click on the ‘.one’ class need to call myFun() but it shouldn’t call display() function which is within that myFun().
This sounds really convoluted but you can pass arguments through to myFun so you know which is which. You’ll still need to stop propagation or both events will fire when you click on .two
<div class="one">
<div class="two">click</div>
</div>
function myFun(one){
// other tasks are going here
if (one) {
display();
}
}
$('.one').on('click', function(){
myFun(true);
}
$('.two').on('click', function(event){
event.stopPropagation();
myFun(false);
}