Easy Tutorial
❮ Prop Audio Preload Dom Obj Attributes ❯

Input Button value Attribute


Definition and Usage

The value attribute sets or returns the value of the value attribute of the button element.

The value attribute specifies the text displayed on the button.

Syntax

Set the value attribute:

Return the value attribute:


Browser Support

All major browsers support the value attribute.


Example

Display the text of the button:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</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>

❮ Prop Audio Preload Dom Obj Attributes ❯