Javascript Form How to - Get value property gets the value entered in the password box








Question

We would like to know how to get value property gets the value entered in the password box.

Answer


<!--  w w  w . ja v  a2s .co  m-->
<html>
<body>
    <form name="form1">
        <input type="PASSWORD" Name="pass" size=10>
        <br>
        <input type="BUTTON" value="Get Value" onClick=console.log(document.form1.pass.value)>
    </form>
</body>
</html>

The code above is rendered as follows: