chihung
9/26/2019 - 8:14 AM

Truncate by Jquery

jQuery(document).ready(function($) {

    $('.truncate').each(function(){
        var truncated = $(this).text().substr(0, 120);
        //Updating with ellipsis if the string was truncated
        $(this).text(truncated+(truncated.length<120?'':'[...]'));
    });
});