disabled attribute does not work in firefox - for a div

后端 未结 3 1086
梦谈多话
梦谈多话 2021-01-22 16:17

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

$(\'#ctl00_ContentPlaceHolder1_RadUploadImage\').attr(\'disable         


        
相关标签:
3条回答
  • 2021-01-22 16:38

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

    0 讨论(0)
  • 2021-01-22 16:44

    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;
    
    0 讨论(0)
  • 2021-01-22 16:51

    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

    0 讨论(0)
提交回复
热议问题