Consider the following:
<div onclick="alert('you clicked the header')" class="header">
<span onclick="alert('you clicked inside the header');">something inside the header</span>
</div>
How can I make it so that when the user clicks the span, it does not fire the div
's click event?
Keep in mind that window.event is not supported in FireFox, and therefore it must be something along the lines of:
Or, you can use the W3C standard for FireFox:
If you want to get fancy, you can do this:
Why not just check which element was clicked? If you click on something,
window.event.target
is assigned to the element which was clicked, and the clicked element can also be passed as an argument.If the target and element aren't equal, it was an event that propagated up.
This worked for me
This also works - In the link HTML use onclick with return like this :
And then the comfirmClick() function should be like: