Skip to content

Conversation

@nazaninsaedi
Copy link
Owner

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.

@nazaninsaedi nazaninsaedi merged commit 0082b5a into main Apr 25, 2024
Copy link

@Ara225 Ara225 left a 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" -->
Copy link

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" -->
Copy link

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 -->
Copy link

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
Copy link

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 == "" ||
Copy link

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
Copy link

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
Copy link

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"
Copy link

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 */
Copy link

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 */
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants