Javascript Form How to - Get hidden field name








Question

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

Answer


<!--  www  .  ja  v  a 2  s  . co m-->
<html>
<body>
    <form name="form1">
    Form name:<input type="hidden" name="hide1" value="Test">
    <P>
    <input type="button" value="Hidden Name"
       onClick='console.log("The Hidden object name is: " + form1.hide1.name)'>
    </form>
</body>
</html>

The code above is rendered as follows: