Reputation: 97
I can't seem to get the jquery time ago plugin to work.
Here is my code
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="jquery.timeago.js"></script>
</head>
<body>
<abbr class="timeago" title="19 March 2013 04:51:33 PM"></abbr>
</body>
</html>
It don't seem to be working...
Upvotes: 0
Views: 2669
Reputation: 3518
you have to initiate the plugin like this
jQuery(document).ready(function($){
$("abbr.timeago").timeago()
});
the final code will be like this
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="jquery.timeago.js"></script>
</head>
<body>
<abbr class="timeago" title="19 March 2013 04:51:33 PM"></abbr>
<script>
jQuery(document).ready(function($){
$("abbr.timeago").timeago()
});
</script>
</body>
</html>
hope this helps
Upvotes: 2
Reputation: 46008
Add this to your page:
jQuery(document).ready(function() {
jQuery("abbr.timeago").timeago();
});
Make sure you follow the instructions from http://timeago.yarp.com/ (See How? section)
Upvotes: 2