IE/Firefox bubble event

marius

Most likely this question has been asked many times before, but as far as I could see, the same responses are given and they do not work for me.

The problem is the following: I have a button control that is rendered as a table and inside this table I have a smaller button. The requirement is that clicking the outer button should show one message and clicking on the small inner button should show another message. I have the code inside this fiddle: http://jsfiddle.net/DZFEZ/3/

$('#mine').click(function (evt) {
    alert("big button click");
});

$('#mine-fav').click(function (evt) {
    alert("small button click");
    var event = evt || window.event; // cross-browser event    
    if (event) {
        event.returnValue = false;
        event.cancelBubble = true;
        event.stopPropagation();
        event.preventDefault();
    }
});

This code works ok on Chrome (and I suspect Opera/Safari. did not check as I cannot install those browsers), but on IE9+ and Fireforx it does not. The event is just triggered on the big outer button, no matter if I click on the small one.

Anybody has any clue why? Thanks, Marius.

Romick
To resolve your problem just replace outer button to div.

Because i think that the button in atomic at those browser and there are some difference in browsers implementation. You should use elements as expected. Working demo

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

jquery event bubble not working

From Dev

Why does scroll event not bubble?

From Dev

How to Create an Observable Sequence of an Event that does not Bubble?

From Dev

For JavaScript event, is bubble better than capture?

From Dev

Ember.js bubble event with the same name

From Dev

How to Create an Observable Sequence of an Event that does not Bubble?

From Dev

Angular 2 how to bubble up an event from a nested component

From Dev

How to bubble up angular2 custom event

From Dev

How to bubble up an event to the very top parent React style?

From Dev

How to bubble up an event to the very top parent React style?

From Dev

How do I bubble an event from a user control up to window it is contained in?

From Dev

How do you make an SVG element mouse event bubble up through another element?

From Dev

HERE Maps (JS v3) - Add event listener to info bubble

From Dev

How do you make an SVG element mouse event bubble up through another element?

From Dev

How do I bubble an event from a user control up to window it is contained in?

From Dev

Excel Bubble graph bubble name

From Dev

Why bubble sort is called bubble sort?

From Dev

Hide bubble in nvd3 bubble chart

From Dev

Confusion on Bubble sort complexity

From Dev

Bubble Sort Algorithm - Scilab

From Dev

Bubble Chart Title and Colors

From Dev

CSS: Talk Bubble

From Dev

Message overflow in notification bubble

From Dev

Speech bubble with arrow

From Dev

Chat bubble size

From Dev

Create Speech Bubble with CSS

From Dev

Bubble - content overflowing

From Dev

How to "bubble up" callback

From Dev

About the Bubble Sort in C