Javascript DOM HTML Input Hidden type Property

Introduction

Find out which type of form element the hidden input field is:

var x = document.getElementById("myInput").type;

Click the button below to find out which type of form element the hidden input field is.

View in separate window

<!DOCTYPE html>
<html>
<body>

<input type="hidden" id="myInput">
<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*from  www .  j  av a 2 s.  c o m*/
  var x = document.getElementById("myInput").type;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

The type property returns which type of form element the hidden input field is.

For a hidden object this will always be "hidden".

The type property returns a String type value.




PreviousNext

Related