Javascript DOM HTML Input Week disable and enable

Introduction

Disable and enable a week field:

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"><br><br>

<button onclick="disableBtn()">Disable Week Field</button>
<button onclick="enableBtn()">enable Week Field</button>
<script>
function disableBtn() {/*  w w  w  .  j  a v a2  s.c  o m*/
  document.getElementById("myWeek").disabled = true;
}

function enableBtn() {
  document.getElementById("myWeek").disabled = false;
}
</script>

</body>
</html>



PreviousNext

Related