JSFiddle - React, Tailwind, and code Playground

by niklasvh

HTML

<div class="wrapper"...>
   <a href="#"...>blah</a>
   <div class="post">stuff</div>
     <a href="#"...>blah</a>
   <div class="post">stuff</div>
     <a href="#"...>blah</a>
   <div class="post">stuff</div>
     <a href="#"...>blah</a>
   <div class="post">stuff</div>
</div>

CSS

.odd{
 color:red;  
}

.even{
 color:blue;   
}

JavaScript

$(function(){
    $(".wrapper div.post:odd").addClass('odd'); 
    $(".wrapper div.post:even").addClass('even'); 
    
});