JSFiddle - React, Tailwind, and code Playground
by id10922606
HTML
<p class="mytext">Lorem ipsum dolor sit amet</p>
<p class="mytext">Lo ipsum dolor sit amet</p>
<p class="mytext">Lore</p>
JavaScript
$(".mytext").each(function() {
var n = $(this).text().length;
alert(n)
if (n > 5){
alert(n+ "more than 5");
$(this).css("color" , "red");
}
}