Skip to content

Commit 22d0fc0

Browse files
committed
9 video
1 parent f7650fe commit 22d0fc0

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

app.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
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+
})

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
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>

0 commit comments

Comments
 (0)