The type
property gets the type of a password field.
type |
Yes | Yes | Yes | Yes | Yes |
var v = passwordObject.type
A String type value representing the type of the password field.
The following code shows how to get the type of the password field.
<!DOCTYPE html>
<html>
<body>
<!-- w ww .j a va 2s . c om-->
Password: <input type="password" id="myPsw">
<button onclick="myFunction()">test</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("myPsw").type;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
</html>
The code above is rendered as follows: