Javascript examples for DOM HTML Element:Input Password
The type property returns the type of form password field.
For a password field, this property will always return "password".
Type | Description |
---|---|
String | The type of form element the password field is |
The following code shows how to check which type of form element the password field is:
<!DOCTYPE html> <html> <body> Password: <input type="password" id="myPsw"> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* www. j a va2 s . c o m*/ var x = document.getElementById("myPsw").type; document.getElementById("demo").innerHTML = x; } </script> </body> </html>