HTML <button> valueAttribute

HTML button 标签参考手册HTML <button> Tag

Examples

Two buttons with the same name that submit different values when clicked:

<form action="demo_form.html" method="get">
  Choose your favorite subject:
  <button name="subject" type="submit" value="fav_HTML">HTML</button>
  <button name="subject" type="submit" value="fav_CSS">CSS</button>
</form>

Try it Yourself »

Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value attribute.

Important:If you use the button element in an HTML form, different browsers will submit different values. Internet Explorer will submit the text between <button> and <button/>, while other browsers will submit the content of the value attribute. In HTML forms, useinput elementto create buttons.


Definition and Usage

The value attribute specifies the initial value of a <button> in a <form>.

Note:In a form, if the button is submitted as form data, only the button's value will be submitted.


Differences Between HTML 4.01 and HTML5

NONE.


Syntax

<button value="value">

Attribute Values

Value Description
value The initial value of the button.


HTML button 标签参考手册HTML <button> Tag Other Extensions