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