I'm looking for a way to target only the span
elements with the class of selection
, but only those that are located after a select element with an id starting with "cf-":
<select id="cf-1234567891322418287202826"></select>
<span class="select2 select2-container">
<span class="selection">
<span class="select2-selection"></span> // Apply CSS HERE
</span>
</span>
<select id="cf-8298298876787346863834334"></select>
<span class="select2 select2-container">
<span class="selection">
<span class="select2-selection"></span> // Apply CSS HERE
</span>
</span>
<select id="tu-656555"></select>
<span class="select2 select2-container">
<span class="selection">
<span class="select2-selection"></span> // DO NOT Apply CSS HERE
</span>
</span>
I've tried the code below, but it doesn't seem to work. Can you spot my mistake?
select[id^="cf-"] + span.select2-selection {
color: blue;
}