function maxNum(){ var a = $(‘#num-length‘); var maxwidth = 5; if (a.text().length > maxwidth) { a.text(a.text().substring(0, maxwidth)); a.html(a.html() + ‘...‘); } }
标签:length .text fun blog 数字 body div 控制 html
function maxNum(){ var a = $(‘#num-length‘); var maxwidth = 5; if (a.text().length > maxwidth) { a.text(a.text().substring(0, maxwidth)); a.html(a.html() + ‘...‘); } }
标签:length .text fun blog 数字 body div 控制 html
原文地址:http://www.cnblogs.com/bertha-zm/p/8042217.html