tags:

views:

33

answers:

1
+1  Q: 

jTruncate / live()

Hello,

I been looking at http://blog.jeremymartin.name/2008/02/jtruncate-in-action.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?

+1  A: 

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);
    }
});
roosteronacid
I will give this a try today.
Randy Johnson