Everywhere on SO there is only selector via value
, but I want to select option
based on it text.
For example, I have this:
<select id="some-id">
<option>1</option>
<option>2</option>
</select>
How get option with text equal to "2"? Something like this:
jQuery("#some-id option[text='2']")
But it is not working for me, how it should be done?