禁用属性在firefox中不起作用 - 对于div [英] disabled attribute does not work in firefox - for a div

查看:118
本文介绍了禁用属性在firefox中不起作用 - 对于div的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友:

下面的代码在ie9中完美工作,但在firefox 3.6中无法正常工作

  $('#ctl00_ContentPlaceHolder1_RadUploadImage')。attr('disabled','disabled'); 

ctl00_ContentPlaceHolder1_RadUploadImage - >是div元素

意思是当我们用萤火虫检查这个div时,显示我们禁用=禁用

但我有一个RadUpload在那个工作仍在工作的div!



html代码如下所示:

 < div disabled =trueid =ctl00_ContentPlaceHolder1_RadUploadImageclass =RadUpload RadUpload_BlackByMe RadUpload_rtl RadUpload_BlackByMe_rtlstyle =width:325px;> 
< input autocomplete =offid =ctl00_ContentPlaceHolder1_RadUploadImage_ClientStatename =ctl00_ContentPlaceHolder1_RadUploadImage_ClientStatetype =hidden>
< ul class =ruInputsid =ctl00_ContentPlaceHolder1_RadUploadImageListContainer>< li>< span class =ruFileWrap ruStyled>< input style =position:absolute; left:0px; -5000px; class =ruFileInputsize =23dir =ltrid =ctl00_ContentPlaceHolder1_RadUploadImagefile0name =ctl00_ContentPlaceHolder1_RadUploadImagefile0type =file>< input size =22class =ruFakeInputtype =text >< input class =ruButton ruBrowsevalue =selecttype =button>< / span>< input name =ClearInputclass =ruButton ruClearvalue =eraseid = ctl00_ContentPlaceHolder1_RadUploadImageclear0type =button>< / li>< / ul>< / div>

有什么想法吗?

预先感谢

解决方案

如果您使用的是jQuery< 1.6这样做:

  $('#ctl00_ContentPlaceHolder1_RadUploadImage')。attr(disabled,'disabled'); 

如果您使用的是jQuery 1.6 +:

  $('#ctl00_ContentPlaceHolder1_RadUploadImage')。prop(disabled,true); 

看到这个问题:

这里给出了相同的答案:。prop()vs .attr https://stackoverflow.com/questions/6048022/jquery-attrdisabled-disabled-not-working-in-chrome\">jQuery .attr(禁用,禁用)在Chrome中无法使用


hi my dear friends :
the below code works perfect in ie9 , but does not work in firefox 3.6

$('#ctl00_ContentPlaceHolder1_RadUploadImage').attr('disabled', 'disabled');

ctl00_ContentPlaceHolder1_RadUploadImage -> is a div element

mean when we check this div with firebug , shows us disabled="disabled"
but i have a RadUpload Inside that div that is working still!

the html code is like below :

<div disabled="true" id="ctl00_ContentPlaceHolder1_RadUploadImage" class="RadUpload RadUpload_BlackByMe RadUpload_rtl RadUpload_BlackByMe_rtl" style="width: 325px;">
            <input autocomplete="off" id="ctl00_ContentPlaceHolder1_RadUploadImage_ClientState" name="ctl00_ContentPlaceHolder1_RadUploadImage_ClientState" type="hidden">
        <ul class="ruInputs" id="ctl00_ContentPlaceHolder1_RadUploadImageListContainer"><li><span class="ruFileWrap ruStyled"><input style="position: absolute; left: 0px; top: -5000px;" class="ruFileInput" size="23" dir="ltr" id="ctl00_ContentPlaceHolder1_RadUploadImagefile0" name="ctl00_ContentPlaceHolder1_RadUploadImagefile0" type="file"><input size="22" class="ruFakeInput" type="text"><input class="ruButton ruBrowse" value="select" type="button"></span><input name="ClearInput" class="ruButton ruClear" value="erase" id="ctl00_ContentPlaceHolder1_RadUploadImageclear0" type="button"></li></ul></div>

any idea?

thanks in advance

解决方案

if you are using jQuery < 1.6 do this:

$('#ctl00_ContentPlaceHolder1_RadUploadImage').attr("disabled", 'disabled');

If you are using jQuery 1.6+:

$('#ctl00_ContentPlaceHolder1_RadUploadImage').prop("disabled", true);

See this question: .prop() vs .attr() for references why.

Same answer was given here: jQuery .attr("disabled", "disabled") not working in Chrome

这篇关于禁用属性在firefox中不起作用 - 对于div的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆