Weird IE problem using this jquery / javascript

I am using the following code:

ieLessThan8OptionDisable = function() {
if ($.browser.msie && parseFloat($.browser.version) < 8) {
    $("select").find("[disabled]").addClass("disabledforie").removeAttr("disabled");
    $("select").change(function(){
        var selected = $(this).val();
        var disabled = $(this).find("[value="+selected+"]").hasClass("disabledforie");
        if (disabled) {
            alert("This option is disabled.\nSelect will be set to the first option.");
            $(this).find("option:first").attr("selected","selected");
         }
        });
    }
}

Basically, this code is for a disabled option in a drop-down list. It works great except for usability issues.

At any time, when I click on a parameter that should be disabled in IE, a pop-up warning appears, after which the selection window is reset to the first position. Things are good. Now, when I click on the selection box to open the drop-down list, it just closes. Basically I have to click on it 2 times, after which it opens.

I tried this in IE6 and IE7. Both have problems.

Any pointers would be great!

thank

0
source share
1 answer

. , , select. IE , , , , , . , :

:

if (disabled) {
  this.blur();// add in
  alert("This option is disabled.\nSelect will be set to the first option.");
  $(this).find("option:first").attr("selected","selected");
}

PS - , IE

+2

All Articles