2015-09-04 26 views
2

I tried to follow this code - confused禁用提交按鈕時,沒有PHP的過程中選擇文件上傳

這是我爲我上傳的代碼。我不確定在哪裏/如何包含jquery代碼來啓用按鈕後文件被選中。我試圖複製這個例子並測試,但我仍然無法實現它的工作。

HTML

<div id="floatLeft"> 
<label for="fileToUpload">Select CSV file to Upload:</label> 
<input type="file" name="fileToUpload" id="fileToUpload"> 
</div> 
<div id="floatRight"> 
<input type="submit" value="Generate" name="submit" disabled /> 

</div> 

JQUERY

$(document).ready(
function(){ 
    $('input:file').change(
     function(){ 
      if ($(this).val()) { 
       $('input:submit').attr('disabled',false); 
       // or, as has been pointed out elsewhere: 
       // $('input:submit').removeAttr('disabled'); 
      } 
     } 
     ); 
}); 
+1

你確定你有jQuery嗎?因爲它工作得很好:https://jsfiddle.net/3x1kLhkm/ – Berriel

+0

你的jQuery的版本是什麼? – aldrin27

+0

我在我的服務器的根目錄中。用' – AmarokVII

相關問題