1
我一直在尋找http://blog.jeremymartin.name/2008/02/jtruncate-in-action.html。它似乎不適用於頁面加載後添加到頁面的html。jTruncate/live()
有誰知道如何工作,或者如果有更好的解決方案嗎?
我一直在尋找http://blog.jeremymartin.name/2008/02/jtruncate-in-action.html。它似乎不適用於頁面加載後添加到頁面的html。jTruncate/live()
有誰知道如何工作,或者如果有更好的解決方案嗎?
解決您的問題的最簡單方法是調用由AJAX調用返回的HTML上的構造函數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);
}
});
我今天就試試這個。 – 2010-01-25 13:43:42