Suppose I have a dropdown (select tag) with 3 values. Our first option has a value of “”. The second option has a value of “something”. And the 3rd option has a value of “something else”. How can I get the innerHTML (text) of the 2nd option? I don’t want to hard code it such that it takes the 2nd option every time though. I want to make sure it’s the first option with a value set.
Share
or:
Attribute Not Equal selector:
:first selector
Note that all of the
<option>s must have thevalueattribute in order for the selector to work as expected. If it’s not guaranteed use this:Has Attribute Selector [name]