Disable and enable a local datetime field:
<!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 ww w . jav a2 s .c o m*/ document.getElementById("myLocalDate").disabled = true; } function enableBtn() { document.getElementById("myLocalDate").disabled = false; } </script> </body> </html>