JSFiddle - React, Tailwind, and code Playground

by Shubham Agrawal

HTML

<div>one</div>
<div>two</div>
<div>three</div>
<div>four</div>

JavaScript

$('div').click(function() {
  //do something different based on whether even or odd div
  if ($(this).is(':even')) {
    $(this).html('even');
  } else {
    $(this).html('odd');
  }
});