开发者

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? 开发者_Go百科So far I haven't found anything.


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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜