HTML button Tag value Attribute Tutorial

In this section, we will learn what the value attribute is and how it works.

What is value Attribute in HTML <button> Tag?

The value attribute is used to set a default value for its <button> element.

Note: use this attribute when the type of the target <button> element is set to “submit” and it is connected to a form.

The value we set for the `value` attribute then could be used in a server when the related form data is submitted as well.

HTML value Attribute in <button> Tag Syntax:

<button type = "submit" value = "value"> </button>

<button> Tag value Attribute Values

We can put any type of value for the `value` attribute and this value will be submitted to a server when the related form data is submitted.

Note: in IEs prior to version 8, only the content within the opening and closing tags of HTML <button> element will be sent to a server. So the value of the `value` attribute is simply ignored for these versions of IEs.

Example: using value attribute in HTML <button> tag

See the Pen using value attribute in HTML <button> tag by Omid Dehghan (@odchan1) on CodePen.

Facebook
Twitter
Pinterest
LinkedIn

Top Technologies