type (HTML attribute)
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
| IE | 5.5 | Buggy |
|---|---|---|
| 6.0 | Buggy | |
| 7.0 | Buggy | |
| Firefox | 1.0 | Full |
| 1.5 | Full | |
| 2.0 | Full | |
| Safari | 1.3 | Full |
| 2.0 | Full | |
| 3.0 | Full | |
| Opera | 9.2 | Full |
| 9.5 | Full |
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.

