Browse Source

Listing 5.15: more join() to build footnote links.

Frederic G. MARAND 9 years ago
parent
commit
4795ad302c
1 changed files with 7 additions and 2 deletions
  1. 7 2
      Chapter 5/05.js

+ 7 - 2
Chapter 5/05.js

@@ -22,11 +22,16 @@ $(document).ready(function () {
   $('span.footnote').each (function (index) {
     $(this)
       .before([
+        '<a href="#footnote-',
+        index + 1,
+        '" id="context-',
+        index + 1,
+        '" class="context">',
         '<sup>',
         index + 1,
-        '</sup>'
+        '</sup></a>'
       ].join(''))
       .appendTo($notes)
-      .wrap('<li></li>');
+      .wrap('<li id="footnote-' + (index + 1) + '"></li>');
   });
 });