Browse Source

Listing 5.13: using inverted dom manip to chain actions.

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

+ 4 - 2
Chapter 5/05.js

@@ -20,7 +20,9 @@ $(document).ready(function () {
   // Create footnotes.
   var $notes = $('<ol id="notes"></ol>').insertBefore('#footer');
   $('span.footnote').each (function (index) {
-    $('<sup>' + (index + 1) + '</sup>').insertBefore(this);
-    $(this).appendTo($notes).wrap('<li></li>');
+    $(this)
+      .before('<sup>' + (index + 1) + '</sup>')
+      .appendTo($notes)
+      .wrap('<li></li>');
   });
 });