Put a class "long" for all div and p elements with more than 50 characters:
$("p, div").filter(function(){ return $(this).text().length >=50; }).addClass('long');
If you do not know how much content you have, then, presumably, this content is generated dynamically by the server, right? And if so, it does not make sense to have a server that knows how much content it will cram into these containers - add a class dynamically when creating a page to send? Why rely on jQuery?
Phrogz
source share