File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,25 +20,26 @@ function populateStorage() {
2020 }
2121}
2222
23- const title = document . getElementById ( "title" ) ;
24- const author = document . getElementById ( "author" ) ;
25- const pages = document . getElementById ( "pages" ) ;
26- const check = document . getElementById ( "check" ) ;
27-
2823//check the right input from forms and if its ok -> add the new book (object in array)
2924//via Book function and start render function
3025function submit ( ) {
26+ const title = document . getElementById ( "title" ) ;
27+ const author = document . getElementById ( "author" ) ;
28+ const pages = document . getElementById ( "pages" ) ;
29+ const check = document . getElementById ( "check" ) ;
3130 if (
3231 title . value == null ||
3332 title . value == "" ||
33+ author . value == null ||
34+ author . value == "" ||
3435 pages . value == null ||
3536 pages . value == ""
3637 ) {
3738 alert ( "Please fill all fields!" ) ;
3839 return false ;
3940 } else {
4041 let book = new Book ( title . value , author . value , pages . value , check . checked ) ;
41- Mylibrary . push ( book ) ;
42+ myLibrary . push ( book ) ;
4243 render ( ) ;
4344 }
4445}
@@ -76,7 +77,7 @@ function render() {
7677 changeBut . className = "btn btn-success" ;
7778 wasReadCell . appendChild ( changeBut ) ;
7879 let readStatus = "" ;
79- if ( myLibrary [ i ] . check == false ) {
80+ if ( myLibrary [ i ] . check == true ) {
8081 readStatus = "Yes" ;
8182 } else {
8283 readStatus = "No" ;
You can’t perform that action at this time.
0 commit comments