Home >Web Front-end >JS Tutorial >JavaScript method to implement reset form (reset)_javascript skills
The example in this article describes how to implement reset form (reset) in JavaScript. Share it with everyone for your reference. The details are as follows:
The following code can reset the input data in the form
<!DOCTYPE html> <html> <head> <script> function formReset() { document.getElementById("frm1").reset(); } </script> </head> <body> <p>Enter some text in the fields below, then press the "Reset form" button to reset the form.</p> <form id="frm1"> First name: <input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br><br> <input type="button" onclick="formReset()" value="Reset form"> </form> </body> </html>
I hope this article will be helpful to everyone’s JavaScript programming design.