Skip to: content, navigation

by Ian Lloyd

type (HTML attribute)

Spec
Depr. Version
No HTML 4
Browser support full matrix
IE5.5+ FF1+ Saf1.3+ Op9.2+
Buggy Full Full Full
type=" { button | reset | submit } "

Example

The type is set to "reset" for this button:

<form>
  <button type="reset">
    <strong>Clear all data</strong> in this form
  </button>
</form>

Description

Just as different types of button may be specified for the input element ("button", "reset", and "submit"), we can specify different button types for the button element—even though it may be a little confusing to see input type="button" and button type="button"! If no type is specified, the default behavior is identical to "submit".

Value

Possible values for type are "button", "reset", and "submit".

Compatibility

IE5.5Buggy
6.0Buggy
7.0Buggy
Firefox1.0Full
1.5Full
2.0Full
Safari1.3Full
2.0Full
3.0Full
Opera9.2Full
9.5Full

The support for this element-specific attribute is good (where the browser supports the element itself).

However, Internet Explorer incorrectly defaults to type="button" rather than "submit" (which is why its support is described as buggy).

User-contributed notes

There are no comments yet.

Add a note

To post a note on this topic, please log in with your SitePoint username and password. If you don't have an account yet, you can create a new account for free.

Related Products

The Principles of Beautiful Web Design

Best Seller!

You don’t need to go to Art School to design great looking web sites!

Book Cover: The Principles of Beautiful Web Design

Download the FREE sample chapters