HTML <button> value attribute
Definition and Usage
value
The attribute specifies the initial value of the <button> element in an HTML form.
Note:Only when the button itself is used to submit the form, the button and its value will be submitted.
Example
Two buttons with the same name submit different values when clicked:
<form action="/action_page.php" method="get"> Please select your favorite subject: <button name="subject" type="submit" value="fav_HTML">HTML</button> <button name="subject" type="submit" value="fav_CSS">CSS</button> </form>
Syntax
<button value="value">
Attribute Value
Value | Description |
---|---|
value | Specify the initial value of the button. |
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
Note:If you use the <button> element in an HTML form, Internet Explorer 8 and earlier versions will submit the text between the <button> and </button> tags, while other browsers will submit value
Content of the attribute.