In jQuery I have a dropdown called #selected_studio. In that drop one I have a <option> with value="studio_17 and says Testing... if you look at the drop down in the browser. I want to read the “Testing…” text no matter if selected or not, just by knowing the value. I attempted to write some JS but it failed and not sure how it should be.
$("#selected_studio option:studio_17").text();
Any ideas on how to do this? I think it’s possible. I’m using jQuery 1.7 if that’s any helpful.
The full HTML:
<select id="selected_studio">
<option value="me">Kevin</option>
<option value="studio_17">Testing...</option>
<option value="null" disabled="disabled">------------------------</option>
<option value="new_studio">Studio Application</option>
</select>
Try this:
This uses the attribute equals selector.