-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDay57Gettingelement.html
38 lines (35 loc) · 1.13 KB
/
Day57Gettingelement.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Day 57</title>
</head>
<body>
<div id='movielist'>
<ol>
<li> Asuran</li>
<li id='kaithi'> Kaithi</li>
<li> Soorarai Pootru</li>
<li> Master</li>
</ol>
</div>
<script>
let movieelem=document.getElementById('movielist');
console.log(movieelem);// we will get the movielist element here
movieelem.style.background='lightgreen'// changing the background for the same
//getting first movie
let fmovie=document.querySelectorAll('ol > li');
for(let m of fmovie){
//alert(m.innerHTML);// all the movie list will be come here
}
let movieelemm=document.getElementById('kaithi');
movieelemm.style.background='red';
//again getting movie list
let ffmovie=document.getElementsByTagName('li');
for(let n of ffmovie){
console.log(n);// all the li elements will come here
}
</script>
</body>
</html>