I have a select
field with some options in it.
(我有一个select
字段,其中包含一些选项。)
Now I need to select one of those options
with jQuery. (现在我需要使用jQuery选择其中一个options
。)
But how can I do that when I only know the value
of the option
that must be selected? (但是当我只知道必须选择的option
的value
时,我怎么能这样做呢?)
I have the following HTML:
(我有以下HTML:)
<div class="id_100">
<select>
<option value="val1">Val 1</option>
<option value="val2">Val 2</option>
<option value="val3">Val 3</option>
</select>
</div>
I need to select the option with value val2
.
(我需要选择值为val2
的选项。)
How can this be done? (如何才能做到这一点?)
Here's a demo page: http://jsfiddle.net/9Stxb/
(这是一个演示页面: http : //jsfiddle.net/9Stxb/)
ask by w00 translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…