I thought that adding a "value"
attribute set on the <select>
element below would cause the <option>
containing my provided "value"
to be selected by default :
<select name="hall" id="hall" value="3">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
但是,这并没有像我预期的那样起作用。如何设置默认选择哪个 <option>
元素?
原文由 Jichao 发布,翻译遵循 CC BY-SA 4.0 许可协议
将
selected="selected"
设置为默认选项。