JSFiddle - React, Tailwind, and code Playground

HTML

<div>hhhhhh
<div>This is a test</div>
<div>Another Div</div>
</div>

JavaScript

$('div:contains("test")').css('background-color', 'red');