Input DatetimeLocal disabled Property - Disable and enable a local datetime field: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Datetime Local

Description

Input DatetimeLocal disabled Property - Disable and enable a local datetime field:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<input type="datetime-local" id="myLocalDate"><br><br>

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

<script>
function disableBtn() {//from   w w  w.j  a v a 2  s  .com
    document.getElementById("myLocalDate").disabled = true;
}

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

</body>
</html>

Related Tutorials