FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

lesson 8 code · k3ith99/JavaScript-DOM-Tutorial@8a62ef3 · GitHub

Repository navigation

Commit 8a62ef3

Browse files
authored andcommitted
lesson 8 code
1 parent 8206d06 commit 8a62ef3

1 file changed

Lines changed: 5 additions & 18 deletions

File tree

‎app.js‎

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,8 @@
11
const bookList = document.querySelector('#book-list');
22

3-
console.log('book list parent element:', bookList.parentElement);
4-
console.log('book list parent node:', bookList.parentNode);
3+
console.log('#book-list next sibling:', bookList.nextSibling);
4+
console.log('#book-list next element sibling:', bookList.nextElementSibling);
5+
console.log('#book-list previous sibling:', bookList.previousSibling);
6+
console.log('#book-list previous element sibling:', bookList.previousElementSibling);
57

6-
console.log('all node children:');
7-
Array.from(bookList.childNodes).forEach(function(node){
8-
console.log(node);
9-
});
10-
11-
console.log('all element children:');
12-
Array.from(bookList.children).forEach(function(node){
13-
console.log(node);
14-
});
15-
16-
const titles = bookList.querySelectorAll('.name');
17-
18-
console.log('Book titles:');
19-
Array.from(titles).forEach(function(title){
20-
console.log(title.textContent);
21-
});
8+
bookList.previousElementSibling.querySelector('p').innerHTML += '<br />Too cool for everyone else!';

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL