File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed
Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change 1- const bookList = document . querySelector ( '#book-list' ) ;
1+ var btns = document . querySelectorAll ( '#book-list .delete ' ) ;
22
3- console . log ( 'book-list next sibling is:' , bookList . nextSibling ) ;
4- console . log ( 'book-list next element sibling is: ', bookList . nextElementSibling ) ;
3+ Array . from ( btns ) . forEach ( function ( btn ) {
4+ btn . addEventListener ( 'click ', function ( e ) {
55
6- console . log ( 'book-list previous sibling is:' , bookList . previousSibling ) ;
7- console . log ( 'book-list previous element sibling is:' , bookList . previousElementSibling ) ;
6+ const li = e . target . parentElement ;
7+ li . parentNode . removeChild ( li )
88
9- bookList . previousElementSibling . querySelector ( 'p' ) . innerHTML += '<br/>too cool for everyone else!' ;
9+ } )
10+ } ) ;
11+
12+ const link = document . querySelector ( '#page-banner a' ) ;
13+
14+ link . addEventListener ( 'click' , function ( e ) {
15+ e . preventDefault ( ) ;
16+ console . log ( 'navigation to ' , e . target . textContent , 'was prevented' ) ;
17+ } )
Original file line number Diff line number Diff line change 1111 < div id ="page-banner ">
1212 < h1 class ="title "> Bookorama</ h1 >
1313 < p > Books for Ninjas</ p >
14+ < a href ='http://www.thenetninja.co.uk '> the net ninja</ a >
1415 < form id ="search-books ">
1516 < input type ="text " placeholder ="Search books... " />
1617 </ form >
You can’t perform that action at this time.
0 commit comments