Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- jQuery(‘.comment .comment-entry’).each(function(){
- var words = jQuery(this).innerHTML.split(' ').length;
- if(words >= 20){ var text = jQuery(this).html();
- var temp = text.substr(0,20);
- // Get the visible part of the string
- var newtext = temp + '<span class="hide">' + text.substr(20,text.length) + '</span>';
- // Recompose the string with the span tag wrapped around the hidden part of it jQuery(this).html(newtext);
- }
- });
Add Comment
Please, Sign In to add comment