JSFiddle - React, Tailwind, and code Playground
HTML
<div>a</div>
<div>b</div>
<div>b</div>
<div>d</div>
JavaScript
$('div').each( function(i) {
//do something different based on whether even or odd div
if (i % 2 === 0) { $(this).html('even'); }
else { $(this).html('odd'); }
});