From b858ebc4a27ce743b480931b5613e2fad51b5843 Mon Sep 17 00:00:00 2001 From: kyle Date: Sun, 5 Jan 2025 08:51:02 -0500 Subject: [PATCH] working on model dialog to add book have completed dialog and lightlty styled. Working on completing the JS --- library-app/index.html | 45 ++++++++++++++++-------------------- library-app/js/javascript.js | 16 +++++++++++-- 2 files changed, 34 insertions(+), 27 deletions(-) diff --git a/library-app/index.html b/library-app/index.html index c468273..01f977f 100644 --- a/library-app/index.html +++ b/library-app/index.html @@ -13,32 +13,27 @@ -
-
-

Book Title

-

Book Author

-

Total Pages: 300

-

Have Read

-
-
-

Book Title

-

Book Author

-

Total Pages: 300

-

Have Read

-
+
-
- - -
- - - - - - - - + + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
diff --git a/library-app/js/javascript.js b/library-app/js/javascript.js index 6091d62..9c71eee 100644 --- a/library-app/js/javascript.js +++ b/library-app/js/javascript.js @@ -1,6 +1,7 @@ const myLibrary = []; const container = document.getElementById("main"); const addBookBtn = document.getElementById("addBook"); +const newBookForm = document.querySelector("form"); const dialog = document.querySelector("dialog"); function Book(title, author, pages, read) { @@ -47,8 +48,19 @@ addBookBtn.addEventListener("click", () => { dialog.showModal() }) -console.log(myLibrary) +newBookForm.addEventListener("submit", (e)=> { + e.preventDefault() + + const inputs = [...newBookForm.elements] + + inputs.forEach((item) => { + console.log(item.value) + }) + +}) + addBookToLibrary("Test Book", "Kyle", "300", true) -console.log(myLibrary) +addBookToLibrary("How the Grinch Stole Christmas", "Dr. Seuss", "12", false) +// console.log(myLibrary) myLibrary.forEach((book) => createCard(book)) \ No newline at end of file