Hidden valueProperty
Hidden Object
Definition and Usage
The value property sets or returns the value of the value attribute of the hidden input field.
The value property defines the default value of the hidden field.
Syntax
Set the value property:
hiddenObject.value="value"
Return the value property:
hiddenObject.value
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the value property.
Examples
Examples
The following example gets the value of the hidden field:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<script>
function displayResult(){
var x=document.getElementById("hidden1").value;
alert(x);
}
</script>
</head>
<body>
<form>
<input type="hidden" id="hidden1" value="example.com">
</form>
<button type="button" onclick="displayResult()">Show the value of the hidden input field</button>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<script>
function displayResult(){
var x=document.getElementById("hidden1").value;
alert(x);
}
</script>
</head>
<body>
<form>
<input type="hidden" id="hidden1" value="example.com">
</form>
<button type="button" onclick="displayResult()">Show the value of the hidden input field</button>
</body>
</html>
Try it yourself »
Hidden Object Other Extensions