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
時,我怎麼能這樣作呢? this
I have the following HTML: 我有如下HTML: spa
<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? 如何才能作到這一點? .net
Here's a demo page: http://jsfiddle.net/9Stxb/ 這是一個演示頁面: http : //jsfiddle.net/9Stxb/ code