I'm seeking some assistance with jQuery selectors and have a specific scenario that I need help with. Here is the HTML structure I am working with:
<ul>
<li class="ln-a"></li>
<li class="ln-b"></li>
<li class="ln-b"></li>
<li class="ln-b"></li>
<li class="ln-c"></li>
<li class="ln-f"></li>
<li class="ln-f"></li>
<li class="ln-f"></li>
</ul>
My query is centered around selecting only the first li element for each letter category (a, b, c). Is there a way to achieve this using CSS selectors alone?
I attempted the following code:
jQuery('li:regexp(class, ln-.*):first').addClass('separator');
However, this approach did not yield the desired outcome.