Skip to content

Commit b2a7d5e

Browse files
committed
fix: correct Book Library JS functionality
1 parent 283fda2 commit b2a7d5e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

debugging/book-library/script.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const checkEl = document.getElementById("check");
2020

2121
// Add book from form
2222
function submitBook(event) {
23-
event.preventDefault(); // Prevent page reload
23+
// Prevent page reload
24+
event.preventDefault();
2425

2526
const titleVal = titleEl.value.trim();
2627
const authorVal = authorEl.value.trim();
@@ -52,7 +53,8 @@ function Book(title, author, pages, check) {
5253
function render() {
5354
const table = document.getElementById("display");
5455
const tbody = table.querySelector("tbody");
55-
tbody.innerHTML = ""; // clear old rows
56+
// clear old rows
57+
tbody.innerHTML = "";
5658

5759
myLibrary.forEach((book, i) => {
5860
const row = tbody.insertRow();

0 commit comments

Comments
 (0)