ソースを参照

Listing 6.6: nested $.each().

Frederic G. MARAND 9 年 前
コミット
3c140e6924
1 ファイル変更10 行追加0 行削除
  1. 10 0
      Chapter 6/06.js

+ 10 - 0
Chapter 6/06.js

@@ -16,6 +16,16 @@ $(document).ready(function () {
         html += '<div class="part">' + entry.part + '</div>';
         html += '<div class="definition">';
         html += entry.definition;
+        if (entry.quote) {
+          html += '<div class="quote">';
+          $.each(entry.quote, function (lineIndex, line) {
+            html += '<div class="quote-line">' + line + '</div>';
+          });
+          if (entry.author) {
+            html += '<div class="quote-author">' + entry.author + '</div>';
+          }
+          html += '</div>';
+        }
         html += '</div>';
         html += '</div>';
       });