JQuery setting the selected attribute on a select list
- by Rupert
I have the following html
<select id="dropdown">
<option>A</option>
<option>B</option>
<option>C</option>
</select>
I have the string "B" so I want to set the selected attrribute on it so it will be:
<select id="dropdown">
<option>A</option>
<option selected="selected">B</option>
<option>C</option>
</select>
How would I do this in JQuery?