File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -70,7 +70,7 @@ function render() {
7070 //insert updated row and cells
7171 let length = myLibrary . length ;
7272 for ( let i = 0 ; i < length ; i ++ ) {
73- let row = table . insertRow ( 1 ) ;
73+ let row = tbody . insertRow ( ) ;
7474 let titleCell = row . insertCell ( 0 ) ;
7575 let authorCell = row . insertCell ( 1 ) ;
7676 let pagesCell = row . insertCell ( 2 ) ;
@@ -81,17 +81,17 @@ function render() {
8181 pagesCell . textContent = myLibrary [ i ] . pages ;
8282
8383
84- //add and wait for action for read/unread button
8584 let toggleReadBtn = document . createElement ( "button" ) ;
8685 toggleReadBtn . className = "btn btn-success" ;
8786 toggleReadBtn . innerText = myLibrary [ i ] . check ? "Yes" : "No" ; // ternary operator
8887 wasReadCell . appendChild ( toggleReadBtn ) ;
8988
9089 toggleReadBtn . addEventListener ( "click" , function ( ) {
9190 myLibrary [ i ] . check = ! myLibrary [ i ] . check ;
92- render ( ) ;
91+ render ( ) ;
9392} ) ;
9493
94+
9595 //add delete button to every row and render again
9696 let deleteBtn = document . createElement ( "button" ) ;
9797 deleteBtn . dataset . index = i ;
You can’t perform that action at this time.
0 commit comments