JSFiddle - React, Tailwind, and code Playground

HTML

<style>
div
{
    float:left;
    width:50px;
    height:50px;
    border:1px solid black;
}
</style>
<div>*</div><div>*</div><div>*</div><div>*</div><div>*</div><div>*</div>
<div>*</div><div>*</div><div>*</div><div>*</div><div>*</div><div>*</div>
<div>*</div><div>*</div><div>*</div><div>*</div><div>*</div><div>*</div>
<div>*</div><div>*</div><div>*</div><div>*</div><div>*</div><div>*</div>

JavaScript

$(function(){
    
   $('div').click(function()
   {
       var next = $(this).next();
       var thisOne = $(this);
       
       while(next.length > 0 && thisOne.position().top == next.position().top)
       {
           thisOne = next;
           next = next.next();
       }
       
       thisOne.html("This one!");
   });
    
});