-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
55 lines (41 loc) · 1.48 KB
/
app.js
File metadata and controls
55 lines (41 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Select the element or group of elements the we want
// Decide the effect we want to apply to the selection
// querySelector('any css'); - selects single
// querySelectorAll('any css') - selects all
// GET ELEMENT BY ID
const titleID = document.getElementById('Title');
console.log(titleID)
titleID.style.color = 'purple'
// Grabs all the items by a given tag in an 'array-like' list
const tagItems = document.getElementsByTagName('li');
console.log(tagItems);
const listItem = document.querySelector('li.special');
console.log(listItem);
//listItem.style.color = 'red'
//returns an 'array-like' list
const classItem = document.getElementsByClassName('special');
console.log(classItem);
classItemList = [...classItem] // << puts array-like object into proper array
classItemList.forEach(function(item){
item.style.color = 'red'
})
//classItem[0].style.color = 'red'
//const listItem = document.querySelectorAll('li.special.last');
//console.log(listItem[0]);
//listItem[0].style.color = 'blue'
// -------------Johns Stuff --------------------------------------------
// const result = document.querySelector('#result');
// result.style.backgroundColor = 'blue';
//
// const item = document.querySelector('.special');
// // console.log(item);
//
// const lastItem = document.querySelector('li:last-child');
// // console.log(lastItem);
//
// const list = document.querySelectorAll('.special');
//
// list.forEach(function(item) {
// console.log(item);
// item.style.color = 'yellow';
// });