Javascript DOM HTML Input DatetimeLocal disabled Property get

Introduction

Find out if a local datetime field is disabled or not:

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

Click the button to find out if the local datetime field is disabled.

View in separate window

<!DOCTYPE html>
<html>
<body>

<input type="datetime-local" id="myLocalDate" disabled>
<button onclick="myFunction()">Test</button>
<p id="demo"></p>

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

</body>
</html>



PreviousNext

Related