Guest User

Untitled

a guest
Nov 19th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. jQuery(‘.comment .comment-entry’).each(function(){
  2. var words = jQuery(this).innerHTML.split(' ').length;
  3.  
  4. if(words >= 20){ var text = jQuery(this).html();
  5. var temp = text.substr(0,20);
  6.  
  7. // Get the visible part of the string
  8. var newtext = temp + '<span class="hide">' + text.substr(20,text.length) + '</span>';
  9.  
  10. // Recompose the string with the span tag wrapped around the hidden part of it jQuery(this).html(newtext);
  11. }
  12. });
Add Comment
Please, Sign In to add comment