Simply put, using this:
<select id="Test">
<option value="1">ABC</option>
<option value="2">DEF</option>
</select>
How can I use jQuery to get option[value="2"]
using only "DEF" - Keep in mind I am using 1.8.2
Thank you!
Simply put, using this:
<select id="Test">
<option value="1">ABC</option>
<option value="2">DEF</option>
</select>
How can I use jQuery to get option[value="2"]
using only "DEF" - Keep in mind I am using 1.8.2
Thank you!
Try the
:contains()
selector:Fiddle
Note that
:contains()
is a wildcard search. If you need an exact match, I think you'll just need to iterate or filter the options and check thetext()
. Here's one possibility:http://jsfiddle.net/YuK2K/