开发者

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 开发者_Python百科the user can change it.


Instead of having no value, try using:

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜