JSFiddle - React, Tailwind, and code Playground
by Ramya Ranganathan
HTML
<!DOCTYPE html>
<html>
<body>
<p>Enter some text in the fields below, then press the "Reset form" button to reset the form.</p>
<form id="myForm">
Name: <input type="text" name="fname"><br><br>
Address: <input type="text" name="lname"><br><br>
Email: <input type="text" name="lname"><br><br>
Phone: <input type="text" name="lname"><br><br>
<input type="button" onclick="saveFields()" value="saveBtn">
<input type="button" onclick="clearAllFields()" value="Clear All Fields">
</form>
<script>
function clearAllFields() {
document.getElementById("myForm").reset();
}
var saveE1;
window.onload = function saveFields() {
saveE1=document.getElementById('saveBtn').onclick;
}
</script>
</body>
</html>