2014-04-09 32 views
0

我需要禁用,而該文件上傳提交按鈕..Uploadify檢查進度

<button type="submit" id="submit_button" class="btn btn-default">Odeslat</button> 

JS:

$('#file_upload').uploadify({ 
    'swf' : 'css/uploadify.swf', 
    'uploader' : 'uploadify.php?galerie=<?php echo $n; ?>', 
    'onUploadProgress' : function(file) { 
     $('#submit_button').prop('disabled', true); 
    } 
}); 

但這不是工作..

編輯

相關CT解決方案:

$('#file_upload').uploadify({ 

     'swf': 'css/uploadify.swf', 
     'uploader' : 'uploadify.php?galerie=<?php echo $n; ?>', 
     'onUploadProgress' : function(file) { 
      $('#submit_button').attr('disabled', 'disabled'); 
     }, 
     'onUploadComplete': function(file) { 
      $('#submit_button').removeAttr("disabled"); 
     } 
    }); 
+0

是否使用jQuery用戶界面?如果是這樣,可能是該按鈕實際上被禁用,它看起來不像是可見的。 – bingo

回答

-1
$('#file_upload').uploadify({ 
    'swf' : 'css/uploadify.swf', 
    'uploader' : 'uploadify.php?galerie=<?php echo $n; ?>', 
    'onUploadProgress' : function(file) { 
     $('#submit_button').attr('disabled', 'disabled'); 
    }, 
    'onComplete': function(event, queueID, fileObj, response, data) { 
        $('#submit_button').removeAttr("disabled") 
     } 
}); 
+1

儘管'.prop'允許第二個參數使用字符串,但'Boolean'是首選。 jQuery文檔中的代碼示例描述了['$(「input」).prop(「disabled」,false);'](http://api.jquery.com/prop/prop2) –

+0

@Derek朕會功夫感謝您的提示,我是否值得投票呢?大聲笑 – ProllyGeek

+0

非常感謝!它工作正常.. – sapharick