JSFiddle - React, Tailwind, and code Playground
HTML
<div id="id">
<p>John</p>
<p>Johny</p>
</div>
JavaScript
var $results = $('#id p:contains("John")').filter(function() {
return $(this).text() === 'John';
});
$results.css('color', 'red');