Skip to content

Commit 76e9852

Browse files
committed
fixed input field check
1 parent a796835 commit 76e9852

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

debugging/book-library/script.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ function submit() {
4242
// read: check.checked
4343
// });
4444

45-
// if (!title.value.trim() || !author.value.trim() || !pages.value || isNaN(parseInt(pages.value))) {
46-
// console.log("Validation failed: One or more fields are empty or invalid");
47-
// alert("Please fill all fields with valid data!");
48-
// return;
49-
// }
45+
if (!title.value.trim() || !author.value.trim() || !pages.value || isNaN(parseInt(pages.value))) {
46+
console.log("Validation failed: One or more fields are empty or invalid");
47+
alert("Please fill all fields with valid data!");
48+
return;
49+
}
5050

5151
let book = new Book(title.value.trim(), author.value.trim(), parseInt(pages.value), check.checked);
5252
// console.log("New book created:", book);

0 commit comments

Comments
 (0)