Remove All

Dropzone.js () call function not called

I have this HTML:

<div id='drop_zone'> <div class="close_button" id="removeAllImages">Remove All</div> <form action="PHP/uploads.php" class="dropzone" id='fbDropZone'></form> </div> 

and this Javascript in $(document).ready(function() {}

 window.Dropzone; Dropzone.autoDiscover = false; $('#fbDropZone').dropzone = { init: function() { fbDropZone = this; $("#removeAllImages").click(function(){fbDropZone.removeAllFiles();}) }, paramName: "file", maxFilesize: 5, maxFiles : 1, autoProcessQueue : false, }; 

But init:function() not executed. I can turn autoProcessQueue to false or true , and this works, so I know that the fbDropZone id correct, but maxFiles also ignored. Am I somewhere wrong in the syntax? I am running Safari 7.

+6
source share
2 answers

It turns out that the position of the code is critical: dropzone calls should be placed outside a loaded or ready-made function (I think you would call it inline).

+7
source

Try:

 Dropzone.autoDiscover = false; $("#mydropzone").dropzone({ init: function() { var $this = this; $("button#clear-dropzone").click(function() { $this.removeAllFiles(true); }); }, paramName: "file", maxFilesize: 5, maxFiles : 1, autoProcessQueue : false }); 
+2
source

All Articles