button Element to Reset Forms
Description
If you set the type
attribute from a button
to reset
,
pressing the button causes all of the input elements in the
form to be reset to their initial state.
There are no additional attributes for reset button.
Example
The following code shows the addition of a reset button to the HTML document.
<!DOCTYPE HTML>
<html>
<body>
<form method="post" action="http://example.com/form">
<p>
<label for="fave">Fruit:
<input autofocus id="fave" name="fave" /></label>
</p><!--from w ww . j a v a 2s. c om-->
<p>
<label for="name">Name: <input id="name" name="name" /></label>
</p>
<button type="submit">Submit Vote</button>
<button type="reset">Reset</button>
</form>
</body>
</html>