I need a CSS selector that selects an element <select>if it contains <option>, which contains or is equal (both meet my requirements) to the specified text. HTML example:
<select name="foo">
<option value="1">First</option>
<option value="2">Second</option>
</select>
I want <select>if it contains, for example, an option labeled "Second". Something like that:
select[option:contains('Second')]
If you don't do this with CSS selectors, I also agree with the jQuery or XPath selectors.
source
share