JSFiddle - React, Tailwind, and code Playground

HTML

<div id="id">
   <p>John</p>
   <p>Johny</p>
</div>

JavaScript

var $results = $('#id').find('*').filter(function() {
    return $(this).text() === 'John';
});

$results.css('color', 'red');