Javascript Form How to - Get hidden object








Question

We would like to know how to get hidden object.

Answer


<!--from   w w w .java  2 s  .c  om-->
<html>
<body>
    <form name="form1">
    <input type="hidden" name="hide1" value="Test">
    <P>
    <input type="button" value="Get Hidden Attributes"
         onClick='console.log(form1.hide1.name + " " + form1.hide1.type + " " + form1.hide1.value)'>
    </form>
</body>
</html>

The code above is rendered as follows: