-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
35 lines (27 loc) · 985 Bytes
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
document.addEventListener("DOMContentLoaded", function () {
const container = document.getElementById("container");
books.forEach((book, index) => {
const card = document.createElement("div");
card.className = "card";
const number = document.createElement("div");
number.className = "card-number";
number.textContent = index + 1;
const sub = document.createElement("div");
sub.className = "card-sub";
sub.textContent = book.sub;
const title = document.createElement("h2");
title.className = "card-title";
title.textContent = book.title;
const text = document.createElement("p");
text.className = "card-text";
text.textContent = book.text;
const button = document.createElement("button");
button.textContent = "read more";
card.appendChild(number);
card.appendChild(sub);
card.appendChild(title);
card.appendChild(text);
card.appendChild(button);
container.appendChild(card);
});
});