Javascript examples for DOM HTML Element:Input Password
The disabled property sets or gets whether a password field should be disabled.
This property reflects the HTML disabled attribute.
Set the disabled property with the following Values
Value | Description |
---|---|
true|false | Sets whether a password field should be disabled |
A Boolean, returns true if the password field is disabled, otherwise it returns false
The following code shows how to disable a password field:
<!DOCTYPE html> <html> <body> Password: <input type="password" id="myPsw"> <button onclick="myFunction()">Test</button> <script> function myFunction() {//from w ww . j a va 2s . c o m document.getElementById("myPsw").disabled = true; } </script> </body> </html>