sinsedrix
sinsedrix

Reputation: 4775

Catching a click event on a SELECT in IE prevents from selection

I want to enlight a select and its td container when I click on like this:

$("#fordelegation").on("click", "td", function (evt) {
    $(".ui-state-focus").removeClass("ui-state-focus");
    $(this).addClass("ui-state-focus");
    $(evt.target).addClass("ui-state-focus");
});

You can test it on this fiddle: http://jsfiddle.net/sinsedrix/9Sudt/

With IE, I get a strange behaviour, I cannot select an option anymore. Some people say they do not get this trick so here are the behaviour videos:

The question is : Where should I dig to fix the bad behaviour ?

I really get stuck on this trick :( so every idea is welcome.

Upvotes: 0

Views: 156

Answers (1)

yunzen
yunzen

Reputation: 33439

edit 1
Setting the style directly works though
http://jsfiddle.net/9Sudt/37/


It all boils down to a IE bug, if you change the class of the select it is redrawn and closed.

See this stackoverflow question and the accepted answer
JQuery select box focus problem in internet explorer

See this example in IE
http://jsfiddle.net/9Sudt/34/ If you click on the select a second time, it works again, because the class is not changed then

Upvotes: 1

Related Questions