I'm using dropbox.js and I get this error: Error: Invalid clickable
option provided . I've tried all solutions possible about the clickable
option.
clickable: "#add-new",
clickable: '#add-new',
clickable: ['#add-new'],
clickable: ["#add-new"],
I've updated my version but still I don't know how to fix it. My objective is to append a button on each added element (previewTemplate) for adding new elements further.
Is there any workaround to fix this or another solution? Thanks.
var myDropzone = new Dropzone('div#myDropzoneElement2', {
maxThumbnailFilesize: 2,
maxFilesize: 2,
acceptedFiles:'image/*',
clickable: ["#add-new"],
thumbnailWidth: 250,
thumbnailHeight: 125,
url: dropzoneUrl,
previewTemplate: "<div class=\"dz-preview dz-file-preview col-sm-12\">\n <div class=\"row\"><div class=\"col-sm-5 col-md-4\"><div class=\"dz-image\"><img data-dz-thumbnail width=\"100%\"/></div><div class=\"dz-filename\">(<span data-dz-size></span>)</div></div>\n <div class=\"col-sm-7 col-md-8\"><div class=\"row\"><div class=\"col-sm-12\"><input type=\"text\" id=\"itemtitle\" placeholder=\"Project title\"name=\"itemtitle\" class=\"info-title form-control\"></div>\n <div class=\"top-15 col-sm-12 \"><textarea id=\"itemdescription\" placeholder=\"Describe here the project with essential informations like material and methods applied. Remember the 5Ws and how!\" rows=\"5\" name=\"itemdescription\" class=\"form-control info-description\"></textarea></div></div></div></div>\n <div class=\"dz-error-message\"><span data-dz-errormessage></span></div>\n <div class=\"dz-success-mark\">\n </div>\n <div class=\"row\"><div class=\"col-sm-12\"><div class=\"dz-progress\"><span class=\"dz-upload\" data-dz-uploadprogress></span></div></div><div class=\"col-sm-6\"><a class=\"dz-remove\" href=\"javascript:undefined;\" data-dz-remove>Remove</a></div><div class=\"col-sm-6\"><button type=\"button\" class=\"dz-update\" id=\"updateinformations\" href=\"javascript:undefined;\" disabled>Update</button></div><div class=\"col-sm-6\"><button type=\"button\" id=\"add-new\">Add New</button></div></div>\n </div>",
});
I don't know for certain, but at a guess i'd say it's because the ID you pass isn't on the page yet - it's in the preview template. So Dropzone tries to select an element that doesn't exist. Try putting the add-new
button on the page before Dropzone is initialised.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.