SilverLight
SilverLight

Reputation: 20468

disabled attribute does not work in firefox - for a div

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

Upvotes: 2

Views: 21269

Answers (3)

Asem Khatib
Asem Khatib

Reputation: 514

You don't have to use JQ for that , just use pure JS like that :

document.getElementById('x').disabled = true;

or if you wanna UNdisable it :

document.getElementById('x').disabled = false;

Upvotes: 1

Naftali
Naftali

Reputation: 146350

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

Upvotes: 11

Satish
Satish

Reputation: 6485

This is discussed here too: http://forum.jquery.com/topic/disable-image-button

Upvotes: 0

Related Questions