Javascript DOM HTML Input Week readOnly Property get

Introduction

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

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

Click the button to find out if the week field is read-only or not.

input elements with type="week" are not supported in Internet Explorer or Firefox.

View in separate window

<!DOCTYPE html>
<html>
<body>

<input type="week" id="myWeek" readonly>
<button onclick="myFunction()">Test</button>
<p id="demo"></p>

<script>
function myFunction() {/*w  w  w.  java2  s .co  m*/
  var x = document.getElementById("myWeek").readOnly;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related