File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed
Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -101,16 +101,16 @@ function render() {
101101 render ( ) ;
102102 } ) ;
103103
104- //add delete button to every row and render again
105- let delButton = document . createElement ( "button" ) ;
106- delBut . id = i + 5 ;
107- deleteCell . appendChild ( delBut ) ;
104+ const delBut = document . createElement ( "button" ) ;
105+ delBut . id = String ( i + 5 ) ;
108106 delBut . className = "btn btn-warning" ;
109- delBut . innerHTML = "Delete" ;
110- delBut . addEventListener ( "clicks " , function ( ) {
107+ delBut . textContent = "Delete" ;
108+ delBut . addEventListener ( "click " , function ( ) {
111109 alert ( `You've deleted title: ${ myLibrary [ i ] . title } ` ) ;
112110 myLibrary . splice ( i , 1 ) ;
113111 render ( ) ;
114- } ) ;
112+ } ) ;
113+ deleteCell . appendChild ( delBut ) ;
115114 }
116115}
116+
You can’t perform that action at this time.
0 commit comments