-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtwo.html
More file actions
35 lines (29 loc) · 962 Bytes
/
Copy pathtwo.html
File metadata and controls
35 lines (29 loc) · 962 Bytes
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>DOM || Chai aur Code</title>
</head>
<body style="background-color: #212121; color:azure;">
<div class="parent">
<div class="day">Monday</div>
<div class="day">Tuesday</div>
<div class="day">Wednesday</div>
<div class="day">Thursday</div>
</div>
</body>
<script>
const parent = document.querySelector(".parent");
//console.log(parent.children[1].innerHTML);
for(let i=0; i< parent.children.length;i++){
//console.log(parent.children[i].innerHTML);
}
parent.children[1].style.color = "orange";
//console.log(parent.firstElementChild);
const day1 = document.querySelector(".day");
//console.log(day1.parentElement);
//console.log(day1.nextElementSibling);
console.log("Nodes: ", parent.childNodes);
</script>
</html>