소스 검색

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>';
       });