Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable clickable the form with Dropzone.js?

I'm using Dropzone.js to upload files to the server. I setting up my Dropzone maxFiles parameter to 10 and I was tried this:

$('.dropzone').dropzone({
    maxFiles: 10,
    init: function() {
        this.on('maxfilesreached', function() {
            $('.dropzone').unbind('click');
        });
    }
});

...but not working. What is the solution to remove clickable from .dropzone or any other way to prevent user to add more files?

like image 664
netdjw Avatar asked Jun 12 '14 20:06

netdjw


1 Answers

Why do not you just use CSS to disable the click event. When max files is reached, Dropzone will automatically add a class of dz-max-files-reached.

Use css to disable click on dropzone:

.dz-max-files-reached {
  pointer-events: none;
  cursor: default;
}
like image 136
XuDing Avatar answered Sep 25 '22 10:09

XuDing