JSFiddle - React, Tailwind, and code Playground

by David Thomas

HTML

<ul>
    <li><a href="#">This is a first-child link</a></li>
    <li><span>This first-child is a span, but has a <a href="#">within that span</a></span></li>
    <li><span>Some text in a span</span>, followed by a <a href="#">link</a></li>
</ul>

JavaScript

$('li:has("> a:first-child")').css('background-color','#f00');