javascript - Dropzone with custom options not working -
i have html i'm trying use dropzone.js
<form id="loaddropzone" method="post" action="" class="dropzone"></form>
and javascript
dropzone.autodiscover = true; $("div#loaddropzone").dropzone({//loading dropzone options paramname: 'photos', url: '#', dictdefaultmessage: "insert files", clickable: true, enqueueforupload: true, maxfilesize: 2, uploadmultiple: false, addremovelinks: true, init: function(){ this.on("addedfile", handlefileadded); this.on("removedfile", handlefileremoved); this.on("error", function(file){if (!file.accepted) this.removefile(file);}); } });
my intention load simple dropzone form can add files. if put in html, action loads defaults settings (i can see example on dropzone.js website). if leave action in form blank (like posted), dropzone.js not working.
any load simple dropzone form?
should jquery selector syntax $("#loaddropzone")
rather $("div#loaddropzone")
?
i able things work expected when initializing via dropzone jquery plugin (including customized default message), adding "dropzone" class prior calling dropzone() method on jquery targeted element:
html:
<div> <button id="dropzonebutton" type="submit">upload photos</button> <div id="dropzoneid" style="width:100%; height: 200px"></div> <div>
jquery:
$(document).on("click", "#dropzonebutton", function(){ $('#dropzonebutton').remove(); $("#dropzoneid").addclass("dropzone").dropzone({ url: "/upload", maxfilesize: 2, maxfiles: 10, capture: "camera", dictdefaultmessage: "please drop files uploaded here" }); });
Comments
Post a Comment