HTML Reset Button
You can create a reset button using the <input>
element with the type
attribute set to “reset”. This button allows users to reset form fields to their default values. Here’s an example:
<form>
<label for="name">Name:</label>
<input type="text" id="name" name="name" value="John Doe"><br>
<label for="email">Email:</label>
<input type="email" id="email" name="email" value="[email protected]"><br>
<input type="reset" value="Reset">
<input type="submit" value="Submit">
</form>
In the example above, we have a simple form with two input fields for name and email. The reset button is created using the <input>
element with type="reset"
. When the reset button is clicked, it will reset the form fields to their initial values.
You can customize the appearance of the reset button by modifying its value attribute, which determines the text displayed on the button. You can also apply CSS styles to the button to change its appearance.
Remember to enclose the form elements within the <form>
tags and provide appropriate names and IDs for the form fields so that they can be submitted correctly.