I'm trying to style the first and last list item within the "wrapper" class by applying the "red" class. I have multiple sections on the page with the "wrapper" class.
<div class="wrapper">
<div class="section">
<ul class="parent">
<li class="child">List Item</li>
<li class="child">List Item</li>
<li class="child">List Item</li>
<li class="child">List Item</li>
<li class="child">List Item</li>
<li class="child">List Item</li>
</ul>
</div>
</div>
<div class="wrapper">
<div class="section">
<ul class="parent">
<li class="child">List Item</li>
<li class="child">List Item</li>
<li class="child">List Item</li>
<li class="child">List Item</li>
<li class="child">List Item</li>
<li class="child">List Item</li>
</ul>
</div>
</div>
Using jQuery you can write,