當select標籤沒有嵌套在form標籤中時,我似乎無法禁用選擇框。有些事情我想是(使用Firefox 3):(通過jQuery)如何禁用不在表單內的選擇框?
$("#mySelect").attr("disabled", true);
$("#mySelect").attr("disabled", "disabled");
(也)
document.getElementById('mySelect').disabled = true;
document.getElementById('mySelect').disabled = true;
下面是HTML:
<select id="mySelect" onchange="updateChoice();">
<option value="1">First</option>
<option value="2" selected="">Second</option>
</select>
我必須有這樣的選擇表單元素中的框?