<button type="button" onclick="ClearFields();">Clear</button>
function ClearFields() {
document.getElementById("textfield1").value = "";
document.getElementById("textfield2").value = "";
}
<form id="myForm">
First name: <input type="text" name="fname" value="Demo"><br>
Last name: <input type="text" name="lname"><br><br>
<input type="file" name="Photo" class=" custom-file-input" id="photo">
<input type="button" onclick="myFunction()" value="Reset form">
</form>
<script>
function myFunction() {
document.getElementById("myForm").reset();
}
</script>
Run code snippetHide results