JSFiddle - React, Tailwind, and code Playground

HTML

<p id='1'></p>
<hr />
<p id='1a'><br /></p>
<hr />
<p id='3success'><b>Match this</b></p>
<hr />
<p id='3successa'>
    <b>Match this</b>
</p>
<hr />
<p id='3fail'><b>Match this</b> but not now because of this test</p>
<hr />

JavaScript

$("p").each(function(){
   if( this.children.length == this.childNodes.length)
        $(this).append("<b style='color:green'>Success</b>")
   else
       $(this).append("<b style='color:red'>Failed</b>")
});