2

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

SilverLight
  • 19,668
  • 65
  • 192
  • 300

3 Answers3

11

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

Community
  • 1
  • 1
Naftali
  • 144,921
  • 39
  • 244
  • 303
  • dear @Neal thanks - i learned something new / but my radupload inside that div is still working - i test my code with prop! so confused1 – SilverLight May 20 '11 at 16:13
  • whats do u mean `radupload inside that div`? what does ur html look like? can you add that to your question? – Naftali May 20 '11 at 16:16
  • my Radupload source contains one ul -> disabled="disabled" about it does not work too ... also li's inside that ul! – SilverLight May 20 '11 at 16:16
  • @LostLord, lol you can't `disable` a div, only input elements like `input, select, textarea, etc` can be disabled – Naftali May 20 '11 at 16:27
  • @LostLord no idea, i have never heard of a disabled div – Naftali May 20 '11 at 16:50
1

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;
Asem Khatib
  • 484
  • 7
  • 14
0

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

Satish
  • 6,457
  • 8
  • 43
  • 63