< select>上的value属性标签未选择默认选项 [英] value attribute on <select> tag not selecting default option
本文介绍了< select>上的value属性标签未选择默认选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
也许我在这里误会了,但是给出了以下html:
Perhaps i'm misunderstanding here, but given the following html:
<select value="2">
<option value="1">Something</option>
<option value="2">Something else</option>
</select>
我希望其他"是默认选择的选项.但是,事实并非如此.为什么会这样,我应该怎么做?
I would expect "Something else" to be the default selected option. However, it does not seem to be. Why is this, and what should I be doing differently?
推荐答案
拥有默认选项的唯一方法是在选项标签中进行选择.
The only way to have a default option is to have selected in the option tag.
<SELECT>
<OPTION>Something
<OPTION SELECTED>Something Else
这篇关于< select>上的value属性标签未选择默认选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文