Javascript DOM HTML Input Date disabled Property get

Introduction

Find out if a date field is disabled or not:

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

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

View in separate window

<!DOCTYPE html>
<html>
<body>

<input type="date" id="myDate" disabled>

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

<script>
function myFunction() {//from ww  w .j a va2s  .  c  o m
  var x = document.getElementById("myDate").disabled;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related