Javascript DOM HTML Input Email disabled Property get

Introduction

Find out if an email field is disabled or not:

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

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

View in separate window

<!DOCTYPE html>
<html>
<body>

E-mail: <input type="email" id="myEmail" disabled>
<button onclick="myFunction()">Test</button>

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

<script>
function myFunction() {// w  w w  .j  a  v  a  2 s. c  o m
  var x = document.getElementById("myEmail").disabled;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related