Sickaaron
Sickaaron

Reputation: 448

IE .attr disabled does not work

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.

Upvotes: 1

Views: 3953

Answers (1)

Erik Philips
Erik Philips

Reputation: 54638

Instead of having no value, try using:

$_2('#overnight').removeAttr('disabled');

Upvotes: 3

Related Questions