Hidden valueProperty

Hidden 对象参考手册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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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>

Try it yourself »


Hidden 对象参考手册Hidden Object Other Extensions