Javascript DOM HTML Input Time readOnly Property get

Introduction

Find out if a time field is read-only or not:

var x = document.getElementById("myTime").readOnly;

Click the button to find out if the time field is read-only.

View in separate window

<!DOCTYPE html>
<html>
<body>

Time: <input type="time" id="myTime" readonly>
<button onclick="myFunction()">Test</button>

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

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

</body>
</html>



PreviousNext

Related