File tree Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Expand file tree Collapse file tree 1 file changed +17
-9
lines changed Original file line number Diff line number Diff line change @@ -8,24 +8,32 @@ formatted dates and times embedded in your HTML (à la microformats).
8
8
9
9
First, load jQuery and the plugin:
10
10
11
- <script src="jquery.min.js" type="text/javascript"></script>
12
- <script src="jquery.timeago.js" type="text/javascript"></script>
11
+ ``` html
12
+ <script src =" jquery.min.js" type =" text/javascript" ></script >
13
+ <script src =" jquery.timeago.js" type =" text/javascript" ></script >
14
+ ```
13
15
14
16
Now, let's attach it to your timestamps on DOM ready:
15
17
16
- <pre>
17
- jQuery(document).ready(function() {
18
- jQuery("abbr.timeago").timeago();
19
- });
20
- </pre>
18
+ ``` html
19
+ <pre >
20
+ jQuery(document).ready(function() {
21
+ jQuery("abbr.timeago").timeago();
22
+ });
23
+ </pre >
24
+ ```html
21
25
22
26
This will turn all abbr elements with a class of timeago and an ISO 8601 timestamp in the title:
23
27
24
- <abbr class="timeago" title="2008-07-17T09:24:17Z">July 17, 2008</abbr>
28
+ ```html
29
+ <abbr class =" timeago" title =" 2008-07-17T09:24:17Z" >July 17, 2008</abbr >
30
+ ```
25
31
26
32
into something like this:
27
33
28
- <abbr class="timeago" title="July 17, 2008">about 1 day ago</abbr>
34
+ ``` html
35
+ <abbr class =" timeago" title =" July 17, 2008" >about 1 day ago</abbr >
36
+ ```
29
37
30
38
As time passes, the timestamps will automatically update.
31
39
You can’t perform that action at this time.
0 commit comments