This repository has been archived on 2022-11-21. You can view files and clone it, but cannot push or open issues or pull requests.
kspace-static/js/trim.js

14 lines
356 B
JavaScript
Raw Normal View History

2019-10-18 13:41:02 +02:00
var length = 35;
var texts = document.getElementsByClassName('trim-that');
for (var i = 0; i < texts.length; i++) {
var text = texts[i];
var string = text.innerHTML
var trimmedString = string.length > length ?
string.substring(0, length - 3) + "..." :
string
text.innerHTML = trimmedString
console.log(text.innerHTML);
}