How to reset all form values using a button in HTML ? Last Updated : 23 Jan, 2024 Comments Improve Suggest changes Like Article Like Report To reset all field values in an HTML form, you can use the <input type="reset"> attribute. When the reset button is clicked, the form will be restored to its default state, without any of the values that were previously entered in the fields, checkboxes, or radio buttons. This can be useful in various scenarios. In this article, we will focus on how to clear input fields. Syntax:<input type="reset">Example 1: Rest form using input type reset HTML <!DOCTYPE html> <html> <body> <h1 style="color: green;"> GeeksforGeeks </h1> <form> <input type="text" placeholder="Email address" id="email" name="email" /> <br /><br /> <input type="password" placeholder="Password" id="pin" name="password" maxlength="8" /> <br /><br /> <input type="reset" value="Reset" style="background-color: red; color: white" /> <input type="submit" value="Submit" style="background-color: green; color: white" /> </form> </body> </html> Output: Example 2: Rest form using JavaScript HTML <!DOCTYPE html> <html> <head> <title>Form Example</title> </head> <body> <h1 style="color: green;"> GeeksforGeeks </h1> <form id="myForm"> <input type="text" placeholder="Email address" id="email" name="email" /> <br /><br /> <input type="password" placeholder="Password" id="pin" name="password" maxlength="8" /> <br /><br /> <button type="button" onclick="resetForm()" style="background-color: red; color: white"> Reset </button> <input type="submit" value="Submit" style="background-color: green; color: white" /> </form> <script> function resetForm() { document.getElementById("myForm").reset(); } </script> </body> </html> Output: Comment More infoAdvertise with us Next Article How to reset all form values using a button in HTML ? A aksrathod07 Follow Improve Article Tags : Web Technologies HTML HTML-Attributes HTML-Questions Similar Reads How to create a Reset Button in form using HTML ? In this article, we will learn how to create a Reset Button in HTML forms. The reset button is used to reset all the form data values and set them to their initial default value. In case of user enters the wrong data then the user can easily correct it by clicking on the "Reset Button". Syntax:< 1 min read How to use multiple submit buttons in an HTML form ? Using multiple submit buttons in an HTML form allows different actions based on the button clicked. Each submit button can trigger a unique server-side or JavaScript process while sharing the same form fields, enabling various functionalities within a single form structure.Syntax<form action="/https/www.geeksforgeeks.org/DE 2 min read How to specify the value of an input element using HTML ? In this article, we will set the value of an input element using HTML. The value attribute for <input> element in HTML is used to specify the initial value of the input element. It has different meaning for different input type: The âbuttonâ, âresetâ and âsubmitâ property specifies the text on 1 min read How to submit a form without using submit button using PHP ? In this article, we will see how to submit the form without clicking the submit button, along with understanding the different ways to accomplish this task through implementation.The form can be submitted without using submit button by implementing a specific event attribute or by clicking the link. 3 min read How to Toggle the Buttons & Submit a Form at the Same Time ? In web development, it is common to come across situations where you need to toggle buttons and submit a form simultaneously This functionality is useful for users to interact with the form by enabling or disabling buttons while processing or submitting form data and integrating a button toggle with 2 min read Like