Javascript Reference - HTML DOM Input Hidden type Property








The type property returns the type string of the hidden input field.

Browser Support

type Yes Yes Yes Yes Yes

Syntax

var v = hiddenObject.type 

Return Value

A String type value representing type string of the hidden input field.





Example

The following code shows how to get type string of the hidden input field.


<!DOCTYPE html>
<html>
<body>
<input type="hidden" id="myInput">
<button onclick="myFunction()">test</button>
<!-- w  w w.  ja v  a 2s .  c  om-->
<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myInput").type;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The code above is rendered as follows: