I have a button that includes an onClick().
<input id="btn1" type=button onClick="myFunc('arg1', 'arg2', 'arg3')">
And a function:
<script type="text/javascript">
function myFunc(a1, a2, a3) {
//do stuff
}
</script>
My button is contained inside a DIV container that has it's own onClick() event.
I need the DIV onClick() to fire (as it does) but NOT when the button inside it is clicked. Then I need only the button's onClick() to fire.
I've done this before by using .bind() to bind a listener event to a button, which automatically passes the event
object as a parameter to the listener function, and then using e.stopPropagation().
But, functions called via HTML onClick() do not seem to have this event passed to them.
Is there a way to invoke stopProagation() within a function that is called via HTML onClick() instead of via .bind()?
Again, the ultimate goal here is to make sure that button's onClick() fires, but it's containing DIV's onClick() does not.