HTML DOM Hidden value property
Definition and Usage
value property sets or returns the value of the hidden input field value attributes.
value attribute defines the default value for the hidden field.
grammar
Set the value property:
hiddenObject.value="value"
Returns the value property:
hiddenObject.value
Browser Support
All major browsers support attribute value
Examples
Examples
The following example can obtain the value of the hidden field:
<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
var x = document.getElementById ( "hidden1") value.;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form>
<Input type = "hidden" id = "hidden1" value = "w3big.com">
</ Form>
<Button type = "button" onclick = "displayResult ()"> Show hidden input field value </ button>
</ Body>
</ Html>
<Html>
<Head>
<Meta charset = "utf-8">
<Title> This tutorial (w3big.com) </ title>
<Script>
function displayResult () {
var x = document.getElementById ( "hidden1") value.;
alert (x);
}
</ Script>
</ Head>
<Body>
<Form>
<Input type = "hidden" id = "hidden1" value = "w3big.com">
</ Form>
<Button type = "button" onclick = "displayResult ()"> Show hidden input field value </ button>
</ Body>
</ Html>
try it"
Hidden Objects