We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 714badb commit f29e2c0Copy full SHA for f29e2c0
debugging/book-library/script.js
@@ -66,8 +66,17 @@ function render() {
66
row.insertCell(1).textContent = book.author;
67
row.insertCell(2).textContent = book.pages;
68
69
- // Read column (static)
70
- row.insertCell(3).textContent = book.check ? "Yes" : "No";
+ // Read/unread button
+ const wasReadCell = row.insertCell(3);
71
+ const readToggleButton = document.createElement("button");
72
+ readToggleButton.className = "btn btn-success";
73
+ readToggleButton.textContent = book.check ? "Yes" : "No";
74
+ wasReadCell.appendChild(readToggleButton);
75
+
76
+ readToggleButton.addEventListener("click", () => {
77
+ myLibrary[i].check = !myLibrary[i].check;
78
+ render();
79
+ });
80
81
// Delete button
82
const deleteCell = row.insertCell(4);
0 commit comments