//限制字符个数
$("div").each(function(){
var maxwidth=50;
if($(this).text().length>maxwidth){
$(this).text($(this).text().substring(0,maxwidth));
$(this).html($(this).html()+'...');
}
});
转载于:https://www.cnblogs.com/summer-qd/p/8287395.html