Input Week disabled Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Week

Description

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

This property reflects the HTML disabled attribute.

Set the disabled property with the following Values

Value Description
true|false Sets whether a week field should be disabled

Return Value

A Boolean, returns true if the week field is disabled, otherwise it returns false

The following code shows how to disable a week field:

Demo Code

ResultView the demo 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  .ja v a 2  s. c om*/
    document.getElementById("myWeek").disabled = true;
}

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

</body>
</html>

Related Tutorials