File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,12 @@ function addBook(e) {
4242 myLibrary . push ( book ) ;
4343 saveStorage ( ) ;
4444 render ( ) ;
45+
46+ // Resets the entry form after adding a book
47+ titleInput . value = "" ;
48+ authorInput . value = "" ;
49+ pagesInput . value = "" ;
50+ readCheckbox . checked = false ;
4551}
4652
4753function Book ( title , author , pages , check ) {
@@ -84,16 +90,18 @@ function render() {
8490 render ( ) ;
8591 } ) ;
8692
87- // Deletes the book from the library
93+ // Deletes the book and notifies the user
8894 const deleteBtn = document . createElement ( "button" ) ;
8995 deleteBtn . className = "btn btn-danger btn-sm" ;
9096 deleteBtn . textContent = "Delete" ;
9197 deleteCell . appendChild ( deleteBtn ) ;
9298
9399 deleteBtn . addEventListener ( "click" , ( ) => {
100+ const deletedTitle = book . title ;
94101 myLibrary . splice ( i , 1 ) ;
95102 saveStorage ( ) ;
96103 render ( ) ;
104+ alert ( `Success: "${ deletedTitle } " has been removed.` ) ;
97105 } ) ;
98106 } ) ;
99107}
You can’t perform that action at this time.
0 commit comments