Javascript Form How to - Get type property associated with the password box








Question

We would like to know how to get type property associated with the password box.

Answer


    <!--from  www  .j a va  2 s.  c o  m-->

<html>
<body>
    <form name="form1">
    <input type="PASSWORD" Name="pass" size=10>
    <br>
    <input type="BUTTON" value="Get Type" onClick=console.log(document.form1.pass.type)>
    </form>
</body>
</html>

The code above is rendered as follows: