I have a <button>
element inside of which I have 2 <span>
elements. I have 2 attached jquery click event handlers for each of the span elements so I can do whatever I like for each click. Here's a quick look of the basic code:
HTML
<button>
<span>Text1</span>
<span>Text2</span>
</button>
Javascript
$(function() {
$('button').bind('click', function() {
console.log('button clicked');
});
$('button > span:eq(0)').bind('click', function() {
console.log('text1 span clicked');
});
$('button > span:eq(1)').bind('click', function() {
console.log('text2 span clicked');
});
});
This is all working fine in Chrome and the click event is captured in the correct order: first on any of the span elements and then the event bubbles up to the parent button element.
The problem is that in Firefox the click event does not fire for any of the span elements, just the button event handler logs the event as being fired.
Here's a fiddle so you can see what I mean: http://jsfiddle.net/spider/RGL7a/2/
Thanks