HTML.lt;button> type property

HTML button type property HTML slt;button-and-label

The type property defines the type of button in an HTML document, refer to the following example:

Two button elements, one is the submit button and the other is the reset button:

<form action="demo_form.html" method="get">
First name: <input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
<button type="submit" value="提交">提交</button>
<button type="reset" value="重置">重置</button>
</form>

Try it out . . .

Browser support

HTML button type property HTML button type property HTML button type property HTML button type property HTML button type property

The type property is supported by all major browsers.


Definitions and usages

The type property specifies the type of button.

Tip: Always specify the type property for the button. The default type for Internet Explorer is "button," while the default value for other browsers, including the W3C specification, is "submit."


The difference between HTML 4.01 and HTML5

NONE.


Grammar

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

The property value

Value Describe
submit The button is the submit button (the value is the default for other browsers except Internet Explorer).
button The button is a clickable button (the default for Internet Explorer).
reset The button is the reset button (clears the form data).


HTML button type property HTML slt;button-and-label