HTML button value property
Examples
Two buttons with the same name, submit a different value when you click on them:
<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>
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"
Browser Support
All major browsers support attribute value.
Important: If you use the button element in an HTML form, different browsers will submit different values.Internet Explorer will submit the text <button> and <button /> between, while other browsers will submit the content value of the property. Please use the HTML form input elements to create a button.
Definition and Usage
value attribute specifies the <form> in <button> initial value.
Note: In the form, if the button as a submit form data, value value of only the form will be submitted.
Differences between HTML 4.01 and HTML5
NONE.
grammar
<button value="value">
Property Value
值 | 描述 |
---|---|
value | 按钮的初始值。 |
HTML <button> tag