Q:

Is it possible to change the selected based on a string of the text?

I am trying to set the select option to selected based on its text
$("#request_showdate_2i").val("November");

<select name="request[showdate(2i)]" id="request_showdate_2i">
<option value="1">January</option>
<option value="2">February</option>
<option value="3">March</option>
<option value="4">April</option>
<option value="5">May</option>
<option value="6">June</option>
<option value="7">July</option>
<option value="8">August</option>
<option value="9">September</option>
<option value="10" selected="selected">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>

nothing changes...I dont have the value portion of the month available to me, just the string...any suggestions

A:

Well, using the :contains() selector works here: 
var month = "December";
$("#request_showdate_2i > option:contains("+ month +")").attr('selected', true);

See: http://www.jsfiddle.net/yijiang/YEXZt/

