开发者

jTruncate / live()

I been looking at http://blog.jeremymartin.name/2008/02/jtruncate-in-a开发者_如何转开发ction.html. It doesn't seem to work for html added to the page after page load.

Does anyone know how that would work or if there is a better solution?


The simplest solution to your problem is to call the jTruncate constructor on the HTML returned by your AJAX calls. Like so:

$.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);
    }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜