2014-04-09 29 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