我正在搜索方法将div设为dropzone,因为我希望dropzone保留在其他html表单中。
所以我找到了jquery方法
<script>
Dropzone.autoDiscover = false;
jQuery(document).ready(function() {
$("#mydropzone").dropzone({
url: "path/to/file",
autoProcessQueue: false
});
});
$(document).on('click', '#btn_special', function () {
// enable auto process queue after uploading started
Dropzone.options.autoProcessQueue = true;
// queue processing
Dropzone.processQueue(); ///////////// it's not work ///////
});
</script>
<form action="some_page.php" method="post">
<table>
<tr>
<td>Member Name</td>
<td><input type="text" name="member_name" /> </td>
</tr>
</table>
<div class="dropzone dropzone-previews" id="mydropzone"> <!-- My dropzone stay at this --></div>
<button type="button" id="btn_special">Upload</button>
<input type="submit" name="submit_htmlform" value="submit" />
</form>
.. 问题是我不知道使用dropzone提交的jquery方法(Dropzone.processQueue();)我只知道javascript方法。但我也不知道将div元素转换为dropzone的javascript方法。我该怎么办?
答案 0 :(得分:0)
尝试改变你的js:
jQuery(document).ready(function() {
var myDropZone = $("#mydropzone").dropzone({
url: "path/to/file",
autoProcessQueue: false,
});
$(document).on('click', '#btn_special', function () {
myDropZone.options.autoProcessQueue = true;
myDropZone.processQueue();
});
});