JSFiddle - React, Tailwind, and code Playground

HTML

<div class="item">
    <img style="position: relative; top: 80px; left: 0px; z-index: 7; width: 27px; height: 27px; opacity: 1!important;" src="someurl" />
    
    <p style="position: relative; top: -25px;">
        Testing
    </p>
</div>

JavaScript

var index = $('.item').filter(function() {
    var text = $.trim($(this).find("p").text());
    if(text == "Cooler")
    alert("Index = "+($(this).index()));
});