简单教程
提交运行
代码编辑器:
<input type="datetime-local" id="myLocalDate"><br><br> <button onclick="disableBtn()">禁用本地时间字段</button> <button onclick="undisableBtn()">启用本地时间字段</button> <script> function disableBtn() { document.getElementById("myLocalDate").disabled = true; } function undisableBtn() { document.getElementById("myLocalDate").disabled = false; } </script>
运行结果: