//限制字符个数$("div").each(function(){ var maxwidth=50; if($(this).text().length>maxwidth){ $(this).text($(this).text().substring(0,maxwidth)); $(this).html($(this).html()+'...'); }});