/ Published in: Other
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
shortenString : function( str, length ){ var newStr = str; var words = str.split('', length + 1); if( words.length > length){ words.pop(); words.push('...'); newStr = words.join(''); } return newStr; }