jQuery's .on() for jQuery TimeAgo

前端 未结 1 1873
清酒与你
清酒与你 2021-01-16 17:52

I\'m looking for a way to trigger the .timeago() function on new $(\"abbr.timeago\" elements inserted dynamically into the page. Right now this is

相关标签:
1条回答
  • 2021-01-16 18:38

    on won't help with this. You can use on to bind an event handler to something which is always on the page so that an event can be triggered on an element not on the page at the time of binding. In this case, it's a little different.

    I've solved this before by simply running $("abbr.timeago").timeago() again when I know things have changed.

    0 讨论(0)
提交回复
热议问题