我正在使用 Jquery 插件http://timeago.yarp.com/来显示时间。
问题是 timeago 不会对动态生成的项目生效。
$(document).ready(function() {
$(".timeago").timeago(); // works perfectly fine for the items which are loaded on page load
//$(".timeago").live(timeago()); // gives me an error ie timeago is not defined
//$(".timeago").live($(".timeago").timeago()); // gives me an error too much recursion.
jQuery.timeago.settings.allowFuture = true;
});
通过一些谷歌搜索,我知道了一些事情,即:
使用 live 与使用 bind 相同,只是它仅限于事件 click、dblclick、keydown、keypress、keyup、mousedown、mousemove、mouseout、mouseover 和 mouseup。
现在怎么办,因为我没有任何点击事件?我该如何绑定这个?