forked from iamshaunjp/JavaScript-DOM-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
21 lines (16 loc) · 581 Bytes
/
app.js
File metadata and controls
21 lines (16 loc) · 581 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const bookList = document.querySelector('#book-list');
console.log('book list parent element:', bookList.parentElement);
console.log('book list parent node:', bookList.parentNode);
console.log('all node children:');
Array.from(bookList.childNodes).forEach(function(node){
console.log(node);
});
console.log('all element children:');
Array.from(bookList.children).forEach(function(node){
console.log(node);
});
const titles = bookList.querySelectorAll('.name');
console.log('Book titles:');
Array.from(titles).forEach(function(title){
console.log(title.textContent);
});