I am trying to reset a form and I have a function, the form resets before it submits. Is there a way to get it to wait a few seconds?
<form action="#" method="POST" id="file-form" name="file-form" enctype="multipart/form-data">
<div class="file-field input-field">
<div class="btn">
<span>File</span>
<input type="file" class="upload" id="files" name="files" multiple>
</div>
<div class="file-path-wrapper">
<input class="file-path validate" type="text" placeholder="Upload one or more files">
</div>
</div>
<button class="btn waves-effect waves-light" type="submit" value="submit" name="action" onclick="submitForm()">Submit
<i class="material-icons right">send</i>
</button>
</form>
<script type="text/javascript">
function submitForm() {
var resetForm = document.getElementsByName('file-form')[0];
resetForm.submit();
resetForm.reset();
return false;
}
</script>