Created
November 5, 2018 10:30
-
-
Save melvinstanly/4e4fdb8c948c1ce237277180b1f331e8 to your computer and use it in GitHub Desktop.
Php File Upload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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