Преглед изворни кода

Listing 5.13: using inverted dom manip to chain actions.

Frederic G. MARAND пре 8 година
родитељ
комит
ef1430e648
1 измењених фајлова са 4 додато и 2 уклоњено
  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>');
   });
 });