JSFiddle - React, Tailwind, and code Playground

HTML

<p><strong>bar</strong></p> 
<p><strong>&lt;foo&gt;</strong></p>

<div id="pea"></div>

JavaScript

var mystring = "bar: "+$('body strong:contains("bar")').length;
mystring = mystring + " barparent:"+$('body strong:contains("bar")').parent().length; 
mystring = mystring + " foo:"+$('body strong:contains("foo")').text().length+" :endfoo";
mystring = mystring + " fooparent:"+$('body strong:contains("foo")').parent().length +" howdy "; // this fails 
mystring = mystring + " fooparentgA:"+$('body > p > strong :has("foo")').length+" howdy "; 
mystring = mystring + " fooparentg2:"+$('body strong:contains(<foo)').text().length +" :2howdy ";

mystring = mystring + " strong:"+$('body strong').length; 
mystring = mystring + " strongparent:"+$('body strong').parent().length; // two p elements 
mystring = mystring + " strongGparent:"+$('body strong').parent().parent().length; // one body 
$('#pea').text(mystring);