Return the value of the value attribute of a button:
The result of x will be:
The value property sets or returns the value of the value attribute of a button.
The value attribute specifies the underlying value that is associated with a button.
Important: If you use the <button> element in an HTML <form>, different browsers will submit different values. Internet Explorer will submit the text between the <button> and </button> tags, while other browsers will submit the content of the value attribute.
The value property is supported in all major browsers.
Return the value property:
Set the value property:
Value | Description |
---|---|
text | The initial value of the button |
Return Value: | A String, representing the underlying value that is associated with the button |
---|
Change the value of the value attribute of a button:
HTML reference: HTML <button> value attribute