Сокращение строки до определённой длинны.
function truncStr( str, maxLength = 25 ){
return str.length > maxLength ? str.substring( 0, maxLength ) + '...' : str;
}
$('.limitted').each(function(){
var $this = $(this);
$this.html( truncStr( $this.html() ) );
});
Комментарии
0Нашли ошибку или хотите дополнить материал?