Using pageless1 to trigger an ajax load of older, timestamped content onto the end of the page, I need .timeago() to act upon those newly loaded dates. It works on the content loaded the first time you arrive at the page, but not the content loaded via Ajax later.
Thanks!
For running plugins (things not event handler based) you can still use the .livequery()
plugin, like this:
$('.selector').livequery(function() {
$(this).timeago();
});
If it's an event handler, .live()
or .delegate()
works, or if it's a plugin you can also run the plugins on loaded content, for example:
$.ajax({
//options...
success: function(data) {
//do stuff
$('.selector', data).timeago();
}
});
This runs the plugin on that selector, but only for elements that came back in that AJAX response, by using the context argument of $(selector, [context])
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With