Skip to content

Commit 8fcaebd

Browse files
author
roberttss
committed
komit 10
1 parent a41f75f commit 8fcaebd

1 file changed

Lines changed: 6 additions & 15 deletions

File tree

‎app.js‎

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,9 @@
1-
var btns = document.querySelectorAll('#book-list .delete');
1+
const list = document.querySelector('#book-list ul');
22

3-
Array.from(btns).forEach(function(btn){
4-
btn.addEventListener('click', function(e){
53

6-
const.li = e.target.parentElement;
7-
li.parentNode.removeChild(li)
8-
9-
});
10-
4+
list.addEventListener('click', function(e){
5+
if(e.target.className == 'delete'){
6+
const li = e.target.parentElement;
7+
list.removeChild(li);
8+
}
119
});
12-
13-
const link = document.querySelector('#page-banner a');
14-
15-
link.addEventListener('click', function(e){
16-
e.preventDefault();
17-
console.log('navigation to ', e.target.textContent, 'was prevented');
18-
})

0 commit comments

Comments
 (0)