Posted By

jgarrettvml on 07/11/12


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

connor3ep
BrockSamsom


Limit string length/trim text with jQuery


 / Published in: jQuery
 

Limit string length/trim text with jQuery

  1. jQuery(document).ready(function($){
  2. $("h3").each(function(){
  3. if ($(this).text().length > 30) {
  4. $(this).text($(this).text().substr(0, 27));
  5. $(this).append('...');
  6. }
  7. });
  8. });

Report this snippet  

You need to login to post a comment.