我一直在看http://blog.jeremymartin.name/2008/02/jtruncate-in-action.html这似乎不适用于在页面加载后添加到页面的html。
有没有人知道这是如何工作的,或者是否有更好的解决方案?
发布于 2010-01-24 03:17:57
问题的最简单解决方案是在AJAX调用返回的超文本标记语言上调用jTruncate构造函数。如下所示:
$.ajax(
{
success: function (html) // HTML is returned
{
// Enable jTruncate on the HTML
var truncatedHTML = $(html).jTruncate(/* options */);
// Append the HTML to your page
$("element to append to").append(truncatedHTML);
}
});
https://stackoverflow.com/questions/2124309
复制相似问题