Easy Tutorial
❮ Jsref Nan Prop Textarea Form ❯

Hidden value Attribute


Definition and Usage

The value attribute sets or returns the value of the value attribute of a hidden input field.

The value attribute defines the default value of the hidden field.

Syntax

Set the value attribute:

Return the value attribute:


Browser Support

All major browsers support the value attribute.


Example

The following example retrieves the value of the hidden field:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>tutorialpro.org(tutorialpro.org)</title>
<script>
function displayResult(){
    var x=document.getElementById("hidden1").value;
    alert(x);
}
</script>
</head>
<body>

<form>
<input type="hidden" id="hidden1" value="tutorialpro.org">
</form>
<button type="button" onclick="displayResult()">Display the value of the hidden input field</button>

</body>
</html>

❮ Jsref Nan Prop Textarea Form ❯