I'am experiencing problem with Firefox 32 when I bind action on click event of span element inside a button element. Other browsers seems to works well.
Here the code illustrating the issue on jsFiddle.
<span onClick="alert('test');">**Working**</span><br>
<button>inside a button <span onClick="alert('test');">**Not working**</span></button>
Does anybody know why and if it's a bug or a feature ?
As far as i known clicking the children elements won't work because it is nested inside a button. A button is not container for child elements - only for text.
If you try like below it always tell that you clicked the button.
So, my suggestion is to use another span or a div
Hope it helps...
Note: Your code will work in chrome but not in firefox and my answer is alternative solution for making work in firefox
You have to add the
pointer-events
property to the span element.Add a pointer-event to your button in css like:
Clicks on the button element will be ignored