编辑下面的代码:【加编码】
<html> <body> <form> <select id="pets"> <option>Cats</option> <option>Dogs</option> </select> </form> <p>Click the button below to disable the dropdown list above.</p> <button onclick="disableElement()">Disable DropDown List</button> <script> function disableElement() { document.getElementById("pets").disabled=true; } </script> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂