Input Date disabled Property - Disable and enable a date field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Date

Description

Input Date disabled Property - Disable and enable a date field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="date" id="myDate"><br><br>

<button onclick="disableBtn()">Disable Date Field</button>
<button onclick="undisableBtn()">Enable Date Field</button>

<script>
function disableBtn() {//from www.  jav  a  2s  .  co m
    document.getElementById("myDate").disabled = true;
}

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

</body>
</html>

Related Tutorials