2013-03-18 99 views
0

我已經搜索了FineUploader文檔,但是當我設置我的上傳按鈕文本如下所示時,更改似乎不會傳播。上傳按鈕仍然顯示默認文本。我錯過了什麼?FineUploader按鈕文本

var manualuploader = new qq.FileUploader({ 
     element: document.getElementById('manual-fine-uploader'), 
     text: { 
      uploadButton: "Select a File" // <========== Setting text here 
     }, 
     action: "/file/upload", 
     autoUpload: false, 
     multiple: false, 
     forceMultipart: true, 
     onComplete: function (id, fileName, json) { 

      $("#divFileUploadLoading").hide(); 
      $("#buttonUploadFile").show(); 

      if (json.success) { 

       displaySuccessMessage("Successfully uploaded: " + fileName); 

       $("#textFileTitle").val(""); 
       $("#textFileDescription").val(""); 
       $("#checkIsDownloadable").prop("checked", true); 
       $("#checkDisplayDetails").prop("checked", true); 
      } 
      else { 

       displayErrorMessage("Failed to upload: " + fileName + " because '" + json.errorMessage + "'"); 
      } 

      g_FileCount = 0; 

      manualuploader.clearStoredFiles(); 
      manualuploader.reset(); 
     }, 
     onSubmit: function (id, fileName) { 

      g_FileCount++; 
     }, 
     onCancel: function (id, fileName) { 

      $("#divFileUploadLoading").hide(); 
      $("#buttonUploadFile").show(); 

      displaySuccessMessage("Canceled upload for: " + fileName); 

      g_FileCount--; 
     } 
    }); 
+0

控制檯中的任何錯誤? – 2013-03-18 14:56:28

+0

@ShadowWizard No.事實上,一切正常。只是文字沒有設置。 – rhughes 2013-03-18 15:16:04

+0

任何方式讓你設置jsfiddle演示重現問題?快速瀏覽一下,看起來圖書館會花錢,在這種情況下,您應該得到圖書館開發人員的個人支持。 – 2013-03-18 15:19:18

回答

6

經過測試和驗證。您仍然需要使用「文本」選項。

text: { 
    uploadButton:'<div>Select a file</div>' 
} 

另一種方法是使用button:選項創建自己的按鈕。

JS:

button: document.getElementById('my-button') 

HTML:

<div id="my-button" class="qq-upload-button">Select a file</div> 
1

嘗試使用的元素:

uploadButton: "<div>Select a File</div>" 

好運!

+0

謝謝,但沒有快樂。 – rhughes 2013-03-18 12:24:08

2

就我而言,所提供的答案不工作。所以我所做的就是在調用FineUploader構造函數之後以編程方式設置相應分區的內容。我的Javascript如下(使用jQuery):

$('div_ID').fineUploader({... your options here }); 
$(".qq-upload-button-selector.qq-upload-button div").text("your custom text"); 

我測試過這個,它適用於我。歡迎任何評論。

希望這會有所幫助。