tadam logo

HTML <button> type Attribute

Example

Two button elements that act as one submit button and one reset button (in a form):
<form action="http://xhtml.co.il/tryit/html/html_form_submit_736.php" method="get">
  First name: <input type="text" name="fname" /><br />
  Last name: <input type="text" name="lname" /><br />
  <button type="submit" value="Submit">Submit</button>
  <button type="reset" value="Reset">Reset</button>
</form>
The output of the code above will be:

Definition and Usage

The type attribute specifies the type of a button.

Tip: Always specify the type attribute for the button. The default type for Internet Explorer is "button", while in other browsers (and in the W3C specification) it is "submit".

Browser Support

The type attribute supported in all major browsers

Syntax

<button type="value">

Attribute Values

ValueDescription
submitThe button is a submit button (this is default for all browsers, except Internet Explorer)
buttonThe button is a clickable button (this is default for Internet Explorer)
resetThe button is a reset button (clears form data)
Was this information helpful?
   

Comments