Let's suppose we have a <div>
and some nested elements:
<div id="outer">
<!-- some code goes here --->
<div id="inner">
<!-- some code goes here --->
</div>
</div>
Some listener (let's call it onOuterClicked
) is bound to #outer
and is captured by #inner
, which is not what I want. The point is that:
I can't alter
onOuterClicked
(I just have no access to it)I want
#inner
to callonInnerClicked
by clickI don't want
#inner
to callonOuterClicked
by click#inner
may be added or deleted later
So if I just bind onInnerClicked
listener to #inner
by jQuery .on
, it will anyway call onOuterClicked
. How can I avoid it?
Sorry if it's a duplicate question, but all answers I found here are about changing body of onOuterClicked
which is not something I can do.