Created
March 17, 2017 08:54
-
-
Save sealucky7/0dbd794029e90d3cb2cf09e799b6138a to your computer and use it in GitHub Desktop.
cutLongText
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function cutLongText() { | |
| var elem, size, text; | |
| size = 120; | |
| elem = $('your classes or id'); | |
| $.each(elem,function(){ | |
| text = $(this).html(); | |
| if (text.length > size) {text = text.slice(0, size);} | |
| $(this).html(text + '...'); | |
| }); | |
| console.log(elem); | |
| } | |
| cutLongText(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment