Skip to content

Commit

Permalink
Refactor addBookBtn.addEventListener
Browse files Browse the repository at this point in the history
Remove duplicate code. No need to manually add the addEventListeners
as they are added in the displayBooks function.
  • Loading branch information
AP-720 committed Sep 21, 2024
1 parent 11917f8 commit 233f097
Showing 1 changed file with 0 additions and 5 deletions.
5 changes: 0 additions & 5 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,6 @@ addBookBtn.addEventListener("submit", (e) => {

addBookToLibrary(title, author, pages, read);
displayBooks();
const removeButton = document.querySelectorAll('.remove-btn');
removeButton.forEach(button => addRemoveBookListener(button));

const toggleRead = document.querySelectorAll(".update-read-btn");
toggleRead.forEach(button => updateRead(button));

document.getElementById("add-book-form").reset();
modal.close();
Expand Down

0 comments on commit 233f097

Please sign in to comment.