File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed
Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -31,14 +31,16 @@ function submit() {
3131 if (
3232 title . value == null ||
3333 title . value == "" ||
34+ author . value == null ||
35+ author . value == "" ||
3436 pages . value == null ||
3537 pages . value == ""
3638 ) {
3739 alert ( "Please fill all fields!" ) ;
3840 return false ;
3941 } else {
40- let book = new Book ( title . value , title . value , pages . value , check . checked ) ;
41- library . push ( book ) ;
42+ let book = new Book ( title . value , author . value , pages . value , check . checked ) ;
43+ myLibrary . push ( book ) ;
4244 render ( ) ;
4345 }
4446}
@@ -77,9 +79,9 @@ function render() {
7779 wasReadCell . appendChild ( changeBut ) ;
7880 let readStatus = "" ;
7981 if ( myLibrary [ i ] . check == false ) {
80- readStatus = "Yes" ;
81- } else {
8282 readStatus = "No" ;
83+ } else {
84+ readStatus = "Yes" ;
8385 }
8486 changeBut . innerText = readStatus ;
8587
@@ -94,7 +96,7 @@ function render() {
9496 deleteCell . appendChild ( delBut ) ;
9597 delBut . className = "btn btn-warning" ;
9698 delBut . innerHTML = "Delete" ;
97- delBut . addEventListener ( "clicks " , function ( ) {
99+ delBut . addEventListener ( "click " , function ( ) {
98100 alert ( `You've deleted title: ${ myLibrary [ i ] . title } ` ) ;
99101 myLibrary . splice ( i , 1 ) ;
100102 render ( ) ;
You can’t perform that action at this time.
0 commit comments