Tyth
Tyth

Reputation: 1824

Select in Opera doesn't close on change event

In Opera (and only in Opera) I have strange behavior of select element. In change event, if I disable this select, it doesn't close (collapse).

    $('select').bind('change', function()
    {
        $(this).attr('disabled', true);
    });

Is it some known issue of opera? So far I haven't found anything.

Upvotes: 1

Views: 557

Answers (3)

Slava Rachek
Slava Rachek

Reputation: 21

Setting disabled attribute did not work for me, but this code works:

$('select').change(function() {  
  $(this).hide();
  var _this = this;
  setTimeout(function() {
    $(_this).show();
  }, 1);
});

Just hide select, and after one millisecond show it.

Upvotes: 2

hallvors
hallvors

Reputation: 6229

Yes, this is a known bug in Opera (as in the "Opera Software knows about it and is working on a fix, but pretty much nobody else in the world can tell because of Opera's closed bug tracker" meaning of "known"). As far as I remember it may even be fixed for Opera 12 but I haven't double-checked that.

For workarounds, you may want to just leave it since a fix is coming in a future Opera version, using a timeout as suggested earlier should work too.

Upvotes: 1

Dr.Molle
Dr.Molle

Reputation: 117334

Use a short delay before disabling the select, 10ms should be sufficient

Upvotes: 0

Related Questions