- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path02_getElementByTagName.js
More file actions
Latest commit
21 lines (17 loc) · 715 Bytes
/
Copy path02_getElementByTagName.js
File metadata and controls
21 lines (17 loc) · 715 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// For Tag name like h1,h2, etc...
//getElementById('tagname')
// node-list = array like object
// index, length property but not array method
constlist_manga=document.getElementsByTagName('li');
console.log(list_manga);//here will result node-list like [li,li,li] use index
// change naruto be capitalize
list_manga[1].style.textTransform='capitalize';
// if use forEach copy obj use spread operator
// if not will not work
constnewListManga=[...list_manga];
newListManga.forEach(function(items){
items.style.textTransform='uppercase';
items.style.padding='1.25rem 0rem';
});
// add background on the last index be blue color
newListManga[newListManga.length-1].style.background='blue';