Javascript 如何捕获dropzonejs插件的事件
我使用插件。 现在我在html文档中编写此代码Javascript 如何捕获dropzonejs插件的事件,javascript,dropzone.js,Javascript,Dropzone.js,我使用插件。 现在我在html文档中编写此代码 <form action="<?php print $this->link('task', 'upload'); ?>" id="pinupload" class="dropzone" style="width:450px;"> </form> 但使用此代码,我无法捕获事件。为什么?对不起,代码在工作,只是我没注意。表单的Id应具有“myDropzone”
<form action="<?php print $this->link('task', 'upload'); ?>" id="pinupload" class="dropzone" style="width:450px;">
</form>
但使用此代码,我无法捕获事件。为什么?对不起,代码在工作,只是我没注意。表单的Id应具有“myDropzone”
Dropzone.options.myDropzone = {
init: function() {
this.on("addedfile", function(file) {
// Capture the Dropzone instance as closure.
var _this = this;
// Listen to the click event
removeButton.addEventListener("click", function(e) {
// Make sure the button click doesn't submit the form:
e.preventDefault();
e.stopPropagation();
// Remove the file preview.
_this.removeFile(file);
// If you want to the delete the file on the server as well,
// you can do the AJAX request here.
});
});
}
};