JSFiddle - React, Tailwind, and code Playground
HTML
<div class="no-text example">100</div>
<div class="with-text example"> <span class="surprise"> 50 </span>
100</div>
<hr> <span class="boldhead">test-output:</span>
<div id="output"></div>
CSS
#output {
background: #00ff00;
}
.boldhead {
font-weight: bold;
}
JavaScript
$(".example").each(function () {
$("#output").append($(this).text());
if ($(this).hasClass('with-text')) $("#output").append(" - with text");
else $("#output").append(" - no text");
$("#output").append("<br>");
});