我正在使用http://www.dropzonejs.com/(dropzone.js)庫。我已經初始化我的表單元素爲一體,如何在點擊按鈕後調用Dropzone.js中的.removeAllFiles()函數
var drop = $("#upload").dropzone({
uploadMultiple: "true",
addRemoveLinks: "true",
thumbnailWidth: "250",
thumbnailHeight: "250",
maxFilesize: "10",
headers: {
"title": titles,
"location": locations,
"tag": tags
}
});
現在,當用戶點擊一個按鈕<button id="close"></button>
,我想用drop.removeAllFiles(true)
功能清空整個列表,在Dropzone.js官方網站的建議。
所以,我嘗試使用
$("#close").click(function(){
drop.removeAllFiles(true);
});
但它不工作,在console.log
我收到錯誤removeAllFiles() is not declared for drop
。
我在哪裏錯了?
VAR下降使全球 –
有沒有在瀏覽器控制檯的任何錯誤 –
是的,當我點擊「#關閉」按鈕,我得到「遺漏的類型錯誤:對象的翻譯:有沒有方法‘removeAllFiles’」 。 – rishy