简单教程
提交运行
代码编辑器:
搜索: <input type="search" id="mySearch"><br><br> <button onclick="disableBtn()">禁用搜索字段</button> <button onclick="undisableBtn()">启用搜索字段</button> <script> function disableBtn() { document.getElementById("mySearch").disabled = true; } function undisableBtn() { document.getElementById("mySearch").disabled = false; } </script>
运行结果: