JSFiddle - React, Tailwind, and code Playground
HTML
<div class="div-cless" style="width:158px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;">
asdasf asf
asf asf asf asf asfas f afs
<div>
<div class="div-cless" style="width:158px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap;">
asdasf a
<div>
JavaScript
$(function() {
$('div').each(function(i) {
if (isEllipsisActive(this))
$(this).css({'color':'red'});
else
$(this).css({'color':'green'});
});
});
function isEllipsisActive(e) {
return (e.offsetWidth < e.scrollWidth);
}