Skip to content

Commit 610f0ce

Browse files
committed
Clear form fields after successful book submission
1 parent 1fb8577 commit 610f0ce

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

debugging/book-library/script.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ function submit() {
4040
let book = new Book(title.value, author.value, pages.value, check.checked);
4141
myLibrary.push(book);
4242
render();
43+
44+
//clear the form after submit
45+
title.value = "";
46+
author.value = "";
47+
pages.value = "";
48+
check.checked = false;
4349
}
4450
}
4551

0 commit comments

Comments
 (0)