Javascript DOM HTML Input Week disabled Property set

Introduction

Disable a week field:

document.getElementById("myWeek").disabled = true;

Click the button to disable the 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">
<button onclick="myFunction()">Test</button>

<script>
function myFunction() {//from  ww w.j  ava  2 s .  c om
  document.getElementById("myWeek").disabled = true;
}
</script>

</body>
</html>

The disabled property sets or gets whether a week field should be disabled.

This property mirrors the HTML disabled attribute.

The <input type="week"> element is not supported in Firefox.

Property Values

Value Description
true The week field is disabled
false Default. The week field is not disabled

The disabled property returns true if the week field is disabled, otherwise it returns false.




PreviousNext

Related