Reset the Multipart / Form-Data object with jQuery

advertisements

Assume a user has uploaded a few pictures into the 'input' tag. How do you empty (aka reset) the 'input' tag below with jQuery?

<form id="ImgForm" enctype="multipart/form-data">
  <input name="pictures[]" type="file" multiple />
</form>


$('#ImgForm input[type="file"]').val('');

OR

$('#ImgForm').reset(); // will reset form.

OR

// trigger reset button click event manually
$('#ImgForm input[type="reset"]).trigger('click');