How can fix this “Dropzone already attached” error?
Asked Answered
L

3

5

HTML

<div class="dz dz-clickable dz-started">
   <div id="design-image" class="dropzone"></div>
</div>

jQuery

Dropzone.autoDiscover = false;
$("div#design-image").dropzone({url:"myUrl"});

I set up Dropzone.autoDiscover = false; still not working.

Lashelllasher answered 6/8, 2016 at 10:39 Comment(0)
H
23

You have to put autoDiscover option before $(document).ready, like :

//Dropzone Configuration
Dropzone.autoDiscover = false;

$(document).ready(function(){
  // Manual dropzone init
  $("div#design-image").dropzone({url:"myUrl"});
});`
Hayden answered 15/2, 2017 at 13:30 Comment(2)
Seems like there was a change when I updated jQuery in my project where Dropzone is initiated before the autodiscover flag was set. Setting the autodiscover flag before ready function is called worked for me.Neau
head banging with it from almost an hour nowWildman
B
4

You already have a reference to the dropzone by giving your html element a class of "dropzone". No need to create it via jquery. Reference it using:

var myDropzone = Dropzone.forElement("div#design-image");

And your $("div#design-image") selector is in-efficient. Ids are supposed to be unique across your whole dom tree. Use $("#design-image")

Bromoform answered 6/8, 2016 at 11:13 Comment(0)
C
2

in your dropzone.js changes:

  Dropzone.autoDiscover = true;

to:

  Dropzone.autoDiscover = false;
Cabot answered 2/8, 2017 at 21:8 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.