Guy, I've created a form where I have a field for attaching files. The attachment process is working properly. But, if I open a new form, the previous attachment is also getting displayed and it is getting attached too(even if I don't attach any file). I've also tried clearing it, but it's not working. This is how I've tried:
html:
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-6">Attachment</label>
<div class="col-sm-6">
<input type="file" name="attachment" id="attachment">
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label id="attachment_label" name="attachment_label"></label>
</div>
</div>
</div>
jquery:
function clear_invoice_request_controls(){
jQuery("#attachment_label").html("");
}
The above jquery shows, how I clear the control. I've tried using, val(), detach(), but it not getting cleared. When I click a new form, that attachment should not be present, but that is not happening. Even if I don't select any attachment, the attachment is getting saved. I don't know what is the mistake. Can someone help me out? I've also shown my html check that out.