HTML DOM Input Button value property
Definition and Usage
value property sets or returns the property value of the value of the button element.
value attribute specifies the text displayed on the button.
grammar
Set the value property:
buttonObject.value="value"
Returns the value property:
buttonObject.value
Browser Support
All major browsers support attribute value
Examples
Examples
: Button Text Display
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
var x = document.getElementById ( "button1") value.;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form>
<Input type = "button" onclick = "displayResult ()" id = "button1" value = "display button text">
</ Form>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
var x = document.getElementById ( "button1") value.;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form>
<Input type = "button" onclick = "displayResult ()" id = "button1" value = "display button text">
</ Form>
</ Body>
</ Html>
try it"
Button Objects