Advertisement
Home Open Editor ❯

HTML <button> type Attribute

Example

<form action="action.php" method="get">
  <label for="fname">First name:</label>
  <input type="text" id="fname" name="fname"><br><br>
  <label for="lname">Last name:</label>
  <input type="text" id="lname" name="lname"><br><br>
  <button type="submit">Submit</button>
  <button type="reset">Submit to another link</button>
</form>

Try this code ❯

Meaning

The type attribute defines the action of the button.

Possible values include button, submit and reset.

In XHTML submit is the default, but browsers may not enforce this in practice.


Standard Syntax

<button type="button|submit|reset">


Advertisement

Attribute Values

Value Description
button The button is a clickable button.
submit The button is a form submission button.
reset The button is a form reset button.
Home Open Editor ❯
Advertisement