type (HTML attribute)

Spec
Depr. Version
No HTML 4
Browser support (more…)
IE8+ FF1+ SA1.3+ OP9.2+ CH2+
Full Full Full Full Full

Syntax

type=" { button | reset | submit } "

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".

Example

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

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

Value

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

Compatibility

Internet Explorer Firefox Safari Opera Chrome
5.5 6.0 7.0 8.0 1.0 1.5 2.0 3.0 3.5 1.3 2.0 3.1 4.0 9.2 9.5 10.0 2.0
Buggy Buggy Buggy Full Full Full Full Full Full Full Full Full Full Full Full Full Full

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

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

User-contributed notes

There are no comments yet.

Related Products