Input Month disabled Property - Disable and enable a month field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Month

Description

Input Month disabled Property - Disable and enable a month field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="month" id="myMonth"><br><br>

<button onclick="disableBtn()">Disable Month Field</button>
<button onclick="enableBtn()">Enable Month Field</button>

<script>
function disableBtn() {//from w w w  . ja  v  a 2 s.c o m
    document.getElementById("myMonth").disabled = true;
}
function enableBtn() {
    document.getElementById("myMonth").disabled = false;
}
</script>

</body>
</html>

Related Tutorials