Latest web development tutorials

HTML DOM Input Button value property

Button Object Reference Button Objects

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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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>

try it"


Button Object Reference Button Objects