ErnieStings
ErnieStings

Reputation: 6403

Jquery code works in firefox but not IE

I have the following event binded to many hyperlinks with the class "riskInformationButton". It works fine in firefox but not in IE.

$(".riskInformationButton").bind("click", function(e){ 

    if (e.stopPropagation) e.stopPropagation( );  
    else e.cancelBubble = true;

    var toggler = $(this).parent().parent().next();         
    while(!toggler.hasClass("spacerRow")){                
        toggler = toggler.toggleClass("hidden").toggleClass("visible").next();         
    }
});

Any help would be much appreciated. Thanks in advance,

Shawn

Upvotes: 0

Views: 194

Answers (1)

Daniel Moura
Daniel Moura

Reputation: 7966

You said you are binding to hypelinks. You should return false on the callback or call e.preventDefault().

It is ok to use bind but you may want to use click instead:

$("riskInformationButton").click(function(e) {
     // your code
});

Upvotes: 4

Related Questions