-
Notifications
You must be signed in to change notification settings - Fork 0
/
tut 14.js
35 lines (29 loc) · 1.1 KB
/
tut 14.js
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
console.log("Welcome to the DOM tut 14");
let element= document.getElementById('first');
// element=document.getElementsByClassName('child');
// element=document.getElementsByTagName('div');
element.innerText="Welcome to the india";
element.innerHTML="<b>Welcome to the Page</b>";
// element=element.className;
// element=element.childNodes;
// element=element.parentNode;
// element.style.color="red";
// let querySelector=document.querySelector('.child');
// querySelector=document.querySelector('#division');
querySelector=document.querySelector('a');
querySelector.style.color="green";
console.log(querySelector);
//2). multiple selector
let multipleSelector=document.getElementsByClassName("container");
multipleSelector=document.getElementsByClassName("child");
multipleSelector=document.getElementsByTagName("div");
console.log(multipleSelector);
for(let i = 0 ; i<multipleSelector.length ; i++){
let y=multipleSelector[i];
console.log(y);
y.style.color="Blue";
}
// Array.from(multipleSelector).forEach(element => {
// console.log(element);
// element.style.color="Blue";
// });