jquery限制div字符长度,超出部分已“…”显示

时间:2014-06-18 13:13:18   收藏:0   阅读:253
1 $(".content").each(function(){  
2                              if($(this).text().length>100){
3                              $(this).text($(this).text().substring(0,100));
4                              $(this).html($(this).html()+‘...‘);    
5                              }
6 })

 

jquery限制div字符长度,超出部分已“…”显示,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!