Input Password disabled Property - Find out if a password field is disabled or not: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Password

Description

Input Password disabled Property - Find out if a password field is disabled or not:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form>
Username:<input type="text" id="usrname"><br>
Password: <input type="password" id="myPsw">
</form><br>

<button onclick="disablePsw()">Disable Password field</button>
<button onclick="enablePsw()">Enable Password field</button>

<script>
function disablePsw() {//from  w  w  w. j  a va 2 s  . c  om
    document.getElementById("myPsw").disabled = true;
}
function enablePsw() {
    document.getElementById("myPsw").disabled = false;
}
</script>

</body>
</html>

Related Tutorials