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>

Click to view the demo





















Home »
  HTML CSS »
    HTML »




HTML Introduction
HTML Document
HTML Section
HTML Group Content
HTML Text Marker
HTML Table
HTML Form
HTML Embed