-
Couldn't load subscription status.
- Fork 0
NW6 | NazaninSaedi | BookLibrary-JS3 | Week-1 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work! I appreciate all the comments and the clean code. The explanation of what you’ve done and how you’ve done it was amazing too! Now I can see you're getting it.
| <label for="title">Title:</label> | ||
| <input | ||
| type="title" | ||
| type="text" <!-- Corrected input type to "text" --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| <label for="author">Author: </label> | ||
| <input | ||
| type="author" | ||
| type="text" <!-- Corrected input type to "text" --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| type="submit" | ||
| value="Submit" | ||
| <button | ||
| type="button" <!-- Changed input type to button --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work. Could you tell me why having type set to submit in this context causes problems?
| function populateStorage() { | ||
| if (myLibrary.length == 0) { | ||
| let book1 = new Book("Robison Crusoe", "Daniel Defoe", "252", true); | ||
| let book1 = new Book("Robinson Crusoe", "Daniel Defoe", "252", true); // Corrected book title |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| title.value == null || | ||
| title.value == "" || | ||
| author.value == null || // Check for author input | ||
| author.value == "" || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| //delete old table | ||
| for (let n = rowsNumber - 1; n > 0; n-- { | ||
| // Delete old table rows | ||
| for (let n = rowsNumber - 1; n > 0; n--) { // Corrected the loop condition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| delBut.className = "btn btn-warning"; | ||
| delBut.innerHTML = "Delete"; | ||
| delBut.addEventListener("clicks", function () { | ||
| delButton.id = i + 5; // Corrected variable name from delBut to delButton |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| cell5.appendChild(delButton); | ||
| delButton.className = "btn btn-warning"; | ||
| delButton.innerHTML = "Delete"; | ||
| delButton.addEventListener("click", function () { // Corrected event name from "clicks" to "click" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| /* Adjusted styles for form-check-label */ | ||
| .form-check-label { | ||
| display: inline-block; | ||
| /* Changed display to inline-block for checkbox label */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch
| .btn { | ||
| display: block; | ||
| display: inline-block; | ||
| /* Changed display to inline-block for buttons to appear inline */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Bugs fixed:
Website loads but nothing works in my JavaScript:
This could be due to several reasons, such as incorrect function calls or script not being loaded properly.
Website loads but nothing happens:
I use debug to pinpoint the exact problem.
Error in console when you try to add a book:
I examined the console error to understand what's causing it and rectify the issue.
It uses the title name as the author name:
We'll ensure that the correct values are passed when creating a new book object.
Delete button is broken:
I fixed the issue with the delete button not functioning properly.
When I add a book that I say I've read - it saves the wrong answer:
l'd ensure that the correct value for the "read" status is saved when adding a book.
Fix the submit() function to pass the correct values when creating a new Book object.