JQuery: Get.timeago () for working with elements loaded after DOM ready (Ajax)

Using pageless1 to start ajax loading of older, time-marked content to the end of the page I need . timeago () to act on these recently uploaded dates. It works with content uploaded the first time it comes to the page, but not with content uploaded via Ajax later.

Thank!

+5
source share
1 answer

To run plugins (not related to the event handler), you can still use the .livequery()plugin , for example:

$('.selector').livequery(function() {
  $(this).timeago();
});

, .live() .delegate(), , , :

$.ajax({
  //options...
  success: function(data) {
    //do stuff
    $('.selector', data).timeago();
  }
});

, , AJAX, $(selector, [context]).

+9

All Articles