I'm using dropzonejs. My HTML is as follows:
<div class="dropzone" id="upload1"></div> <script> $("#upload1").dropzone({ url: "upload.php?frm=logo", paramName: "post_ipfld", dictDefaultMessage: "Drop Files or Select", success: function(file, response) { $("#id").val($.trim(response)); ////////// Save the values in db $.ajax({ url: "save.php?frm=new", type: "post", data: $("#frm_save").serialize(), success: function(d) { $("#pid").val($.trim(d)); } }); } }); </script> The above is working fine. The problem is that I have a clear link in the end of the form. By clicking this clear link I need to clear some form fields but I can't get it to clear my dropzone field.
I am successfully clearing the form fields like this:
$('#fld1, #fld2, #fld5').val(''); To clear the dropzone I tried this:
var myDropzone = $("#upload1").dropzone(); myDropzone.removeAllFiles(true); $('div.dz-image').remove(); How do I use removeAllFiles()?