Quellcode durchsuchen

Listing 6.6: nested $.each().

Frederic G. MARAND vor 9 Jahren
Ursprung
Commit
3c140e6924
1 geänderte Dateien mit 10 neuen und 0 gelöschten Zeilen
  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>';
       });