I need to check if a <select> has an option whose text is equal to a specific value.
For example, if there’s an <option value="123">abc</option>, I would be looking for “abc”.
Is there a selector to do this?
Im looking for something similar to $('#select option[value="123"]'); but for the text.
This could help:
Demo fiddle
This would give you the option with text
Band not the ones which has text that containsB.For recent versions of jQuery the above does not work. As commented by Quandary below, this is what works for jQuery 1.9.1:
Updated fiddle