Javascript DOM HTML Input Submit disabled Property get

Introduction

Find out if a Submit button is disabled or not:

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

Click the button to find out if the Submit button is disabled.

View in separate window

<!DOCTYPE html>
<html>
<body>
<input type="submit" id="mySubmit" disabled>
<button onclick="myFunction()">Test</button>

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

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

</body>
</html>



PreviousNext

Related