Input Button value Property
Example
Change the text displayed on a button:
document.getElementById("myBtn").value = "BMW";
Try it Yourself »
Definition and Usage
The value property sets or returns the value of the value attribute of an input button.
The value attribute defines the text that is displayed on the button.
Browser Support
Property | |||||
---|---|---|---|---|---|
value | Yes | Yes | Yes | Yes | Yes |
Syntax
Return the value property:
buttonObject.value
Set the value property:
buttonObject.value = text
Property Values
Value | Description |
---|---|
text | The text displayed on the button |
Technical Details
Return Value: | A String, representing the text displayed on the input button |
---|
More Examples
Example
Get the text displayed on a button:
var x = document.getElementById("myBtn").value;
Try it Yourself »
Related Pages
HTML reference: HTML <input> value attribute
❮ Input Button Object