You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<li>Finding HTML Elements by HTML Object Collection</li>
12
+
<h3>Below Example Getting Elements by id and CSS Selectors can be changed and displayed but getting element from className and tagName does not work properly</h3>
13
+
`
14
+
}
15
+
16
+
// Getting Element By Id
17
+
18
+
lettextTwo=document.getElementById('textTwo');// --> Mostly Used
19
+
20
+
functionDisplayTwo(){
21
+
textTwo.innerHTML="WE HAVE GOT THIS VALUE FROM id"
22
+
}
23
+
24
+
// Getting Elements by className
25
+
26
+
lettextThree=document.getElementsByClassName("textThree");// --> Not Used Mostly
27
+
28
+
functionDisplayThree(){
29
+
textThree.innerHTML="WE HAVE GOT THIS VALUE FROM className";
30
+
}
31
+
32
+
// Getting Elements by tagName
33
+
34
+
lettextFour=document.getElementsByTagName('h3');// Use Fewly
35
+
36
+
functionDisplayFour(){
37
+
textFour.innerHTML="WE HAVE GOT THIS VALUE FROM tagName";
38
+
}
39
+
40
+
// Getting Elements by CSS Selector
41
+
42
+
lettextFive=document.querySelector('p.one');
43
+
44
+
functionDisplayFive(){
45
+
textFive.innerHTML="WE HAVE GOT THIS VALUE FROM CSS Selector";
0 commit comments