Javascript DOM HTML Input Month disabled Property get

Introduction

Find out if a month field is disabled or not:

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

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

View in separate window

<!DOCTYPE html>
<html>
<body>

<input type="month" id="myMonth" disabled>

<button onclick="myFunction()">Test</button>
<p id="demo"></p>

<script>
function myFunction() {/*from  w w w. ja va  2s.  co m*/
  var x = document.getElementById("myMonth").disabled;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related