2
$("a.newslinks").each(function(){
if ($(this).text().length > 38) {
$(this).text().substr(35); //does not work
$(this).append('...'); //works
$(this).css({ "color" : "#ff00cc" }); //works
}
});
如果一个链接的文本长度超过38个字符,我如何将它修剪为35个字符,并在末尾添加一个缩略图?substr方法链接文本并添加省略号?