How to use jquery if in one of the news-tags classes the text is more than 40 characters, trim it to 38 characters, and add 2 points?

    1 answer 1

    figured out

    function substr_tags() { $('.news-tags').each(function () { var text = $(this).text(); if(text.length > 40) { text = text.slice(0,30); text += '..'; $(this).text(text); } }); }