Latest web development tutorials

HTML DOM Button value property

Button Object Reference Button Objects

Definition and Usage

value property sets the property value or return value on the button.

value attribute specifies the text displayed on the button

Important: If you use the button element in HTML form form, different browsers will display different values.Internet Explorer is displayed in the <button> and </ button> tag value, while other elements are displayed on the value of the property value. In the HTML form form you can use the input element to display the button.

grammar

buttonObject.value=value


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support attribute value


Examples

Examples

Return to display text on the button:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>本教程(w3big.com)</title>
</head>
<body>

<input type="button" id="button1" value="点我!">
<p>按钮的文本:
<script>
document.write(document.getElementById("button1").value);
</script></p>

</body>
</html>

try it"


Button Object Reference Button Objects