I have something similar to the following:
<div onclick="doSomething()">
Content...
<div onclick="doSomethingElse()">
</div>
</div>
When doSomethingElse()
is called, I don't want doSomething()
to be called as well.
Searching the web, I found references to event.stopPropagation()
and event.cancelBubble()
, which prevent the event from bubbling up to parent elements.
Two questions:
How can I get the event object from
doSomethingElse()
?Is it necessary to use both
event.stopPropagation()
andevent.cancelBubble()
, or has the industry settled on a standard for this?