-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuerySelector.html
More file actions
51 lines (46 loc) · 1.43 KB
/
Copy pathQuerySelector.html
File metadata and controls
51 lines (46 loc) · 1.43 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>DOM</title>
<link rel="stylesheet" href="styles/dom.css">
<style>
.big-black p {
color: brown;
}
#list li{
color:aquamarine;
}
</style>
</head>
<body>
<div class="big-black">
<h1 class="heading">DOM learning with chai aur code</h1>
<p>DOM stands for Document Object Model. It is a programming interface that represents the structure of a web page, allowing JavaScript to manipulate HTML and CSS dynamically.</p>
</div>
<h1 id="list">List of Foods</h1>
<ul>
<li class="special">Pizza</li>
<li>Burger</li>
<li class="special">Pasta</li>
<li>Sushi</li>
<li class="special">Salad</li>
<li class="special">Fried Rice</li>
<li>Steak</li>
<li class="special">Tacos</li>
<li>Sandwich</li>
<li>Ice Cream</li>
</ul>
<script>
// to get the first element
console.log(document.querySelector('#list li'));
//to get all elements under it
const place=document.querySelectorAll('#list li');
console.log(place);
const anplace=document.querySelectorAll('.big-black');
console.log(anplace);
console.log(document.querySelectorAll('.special'));
//difference between html collection and nodelist
</script>
</body>
</html>