How to disable clickable the form with Dropzone.js?

后端 未结 10 972
孤城傲影
孤城傲影 2020-12-29 08:39

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:

$(\'.         


        
10条回答
  •  遥遥无期
    2020-12-29 09:01

    Here we go, updated based on comments below.

    How to disable the dropzone "click to open file dialog box" event when maxFiles is reached:

    $('.dropzone').dropzone({
        maxFiles: 10,
        init: function() {
            this.on('maxfilesreached', function() {
                $('.dropzone').removeClass('dz-clickable'); // remove cursor
                $('.dropzone')[0].removeEventListener('click', this.listeners[1].events.click);
            });
        }
    

    I don't know how reliable the "1" in this.listeners[1] is, but that's where the click event function lives in my current dropzone configuration.

提交回复
热议问题