Javascript Form How to - Get hidden field value








Question

We would like to know how to get hidden field value.

Answer


<html>
<body>
    <form name="form1">
    Form name:<input type="hidden" name="hide1" value="Test">
    <P>
    <input type="button" value="Get Hidden Value"
       onClick='console.log("The Hidden object value is: " + form1.hide1.value)'>
    </form>
</body><!--from   w ww  .j a  v a 2  s. com-->
</html>

The code above is rendered as follows: