1

I have a function that would check if the product is available overnight - but it's not working in IE. It works fine in other browsers.

function checkOvernight() {
    id = $_2("[name='product']").val();
    if(id.length > 0) {     
        var url="inc/pscript/checker.php";
        $_2.post(url,{checkOvernight:id},function(data){
                if(data == '0') { 
                    $_2('#overnight').attr('disabled','disabled');
                } else { 
                    $_2('#overnight').attr('disabled','');

                }
        });     
    }
}

I have tried:

$_2('#overnight').attr('disabled','disabled');
$_2('#overnight').attr('disabled',true);

But it's not working with IE. How can I get this to work in IE and all browsers? The disable is for a < select > box, if disabled is true then the user cannot change this field, but if it is false (not disabled) then the user can change it.

Sickaaron
  • 448
  • 1
  • 12
  • 21

1 Answers1

3

Instead of having no value, try using:

$_2('#overnight').removeAttr('disabled');
Erik Philips
  • 53,428
  • 11
  • 128
  • 150
  • I came across this same issue. This works in IE7+, but not IE6 as far as I can tell. – chad Sep 16 '11 at 15:50
  • You should use .prop('disabled', true/false) http://stackoverflow.com/questions/10242205/removeattr-not-removing-disabled-attribute-in-ie – Bron Davies Nov 15 '13 at 21:08