Skip to content

Instantly share code, notes, and snippets.

@melvinstanly
Created November 5, 2018 10:30
Show Gist options
  • Save melvinstanly/4e4fdb8c948c1ce237277180b1f331e8 to your computer and use it in GitHub Desktop.
Save melvinstanly/4e4fdb8c948c1ce237277180b1f331e8 to your computer and use it in GitHub Desktop.
Php File Upload
<html>
<form id="sample_form" name="sample-form">
<p>
<label>Name</label><br>
<input value="Melvin Stanly" type="text">
</p>
<p>
<label>File</label><br>
<input id="example-file" type="file">
</p>
<p>
<button id="reset_form" type="button">Reset file</button>
</p>
</form>
</html>
// Js function
<script>
$('#reset_form').on('click', function(e){
var $el = $('#example-file');
$el.wrap('<form>').closest('form').get(0).reset();
$el.unwrap();
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment