Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

disabled attribute does not work in firefox - for a div

Tags:

html

jquery

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

like image 964
SilverLight Avatar asked Dec 07 '25 12:12

SilverLight


1 Answers

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

like image 78
Naftali Avatar answered Dec 10 '25 02:12

Naftali