Javascript DOM HTML Input Password disabled Property get

Introduction

Find out if a password field is disabled or not:

var x = document.getElementById("myPsw").disabled;

Click the button to find out if the password field is disabled.

View in separate window

<!DOCTYPE html>
<html>
<body>

Password: <input type="password" id="myPsw">
<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {// w w  w . ja  v  a  2 s . co  m
  var x = document.getElementById("myPsw").disabled;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related