say I have a dropdown list like this:
<select id="MyDropDown">
<option value="0">Google</option>
<option value="1">Bing</option>
<option value="2">Yahoo</option>
</select>
and I want to set the selected value based on the option text, not the value with javascript. How can I go about doing this? For example, with c# I can do something like the example below and the the option with "Google" would be selected.
ListItem mt = MyDropDown.Items.FindByText("Google");
if (mt != null)
{
mt.Selected = true;
}
Thanks in advance for any help!