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);
}
});
精彩评论