Javascript DOM HTML Input Datetime disabled Property get

Introduction

Find out if a datetime field is disabled or not:

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

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

input elements with type="datetime" is supported by Safari.

View in separate window

<!DOCTYPE html>
<html>
<body>

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

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

</body>
</html>



PreviousNext

Related