0

在这个 Jquery 函数中,我想启用一个浏览按钮,但我做不到。按钮ID是ctl00_ContentPlaceHolder1_fupSendNewDocument

    <script language="javascript" type="text/javascript">
    function pageLoad() {
  $(function () {

    /********************************************Open and close model window for File Upload*********************************/

    $('#divAttach').click(
      function () {

        var filedivcount = $('div').filter('#MultiFilelabel1').length;

        var $btn = $('#divAttach');

        var count = ($btn.data("click_count") || 0) + 1;

        $btn.data("click_count", count);

        $("#ctl00_ContentPlaceHolder1_fupSendNewDocument").attr("disabled", false);


        if ($('input').filter('#ctl00_ContentPlaceHolder1_fupSendNewDocument_F1').length > 0) {
          if (count < 3 || filedivcount < 3) {
            document.getElementById('ctl00_ContentPlaceHolder1_fupSendNewDocument_F1').click();
          } else {
            alert('you can upload only 3 files');
          }


        }

        if ($('input').filter('#ctl00_ContentPlaceHolder1_fupSendNewDocument_F4').length > 0) {
          if (count < 3 || filedivcount < 3) {
            document.getElementById('ctl00_ContentPlaceHolder1_fupSendNewDocument_F4').click();
          } else {
            alert('you can upload only 3 files');
          }


        } else {

          if (count < 3 || filedivcount < 3) {
            document.getElementById('ctl00_ContentPlaceHolder1_fupSendNewDocument').click();
          } else {
            alert('you can upload only 3 files');
          }

        }
      }
    );
  });
}
    </script>
4

1 回答 1

1

大多数浏览器并不关心 disabled 属性的值。如果它在那里,它将被禁用。http://www.w3schools.com/tags/att_input_disabled.asp

因此,您需要删除该属性:

$("#ctl00_ContentPlaceHolder1_fupSendNewDocument").removeAttr("disabled");
于 2013-09-23T09:17:04.433 回答