-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDom.js
More file actions
54 lines (37 loc) · 1.71 KB
/
Copy pathDom.js
File metadata and controls
54 lines (37 loc) · 1.71 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
52
53
54
// let div=document.querySelector('div');
// div.innerText;
//OUTPUT-> 'Fruits\n\nMango\nApple\nGauava\nBanana'
//div.innerHTML;
/*output-> '\n <ul>\n <p>Fruits</p>\n\n <li>Mango</li>\n <li>Apple</li>\n <li>Gauava</li>\n <li>Banana</li>\n\n </ul>\n '*/
//div.innerText='Raja'; ->change the content of that particular tag
// div.innerHTML='<div>Raja</div>';
//output->'<div>Raja</div>'
/* 2. Practice Question */
//input->hello js ,from apna college ->output->hello js ,from apna college append,(apna collegee)
// let h2=document.querySelector('h2');
// h2.innerText='apna college'; ->output-> Apna college
// h2.innerText=h2.innerText+'from Apna college';
/* practice Question ->give unique name each div*/
// let divs= document.querySelectorAll('.box');
// let index=1;
// for(let div of divs){
// div.innerText=`first div ${index}`;
// index++;
// }
//OR
// divs.forEach((div)=>{
// div.innerText=`first div ${index}`;
// index++;
// })
/*Creation of some Tags using JS*/
//let button=document.createElement("button");
// button.innerText='Click me';
//let div=document.getElementById('parentBox');
//at the last of chillsdiv
// div.append(button);
//at the first of childdivs
// div.prepend(button);
//at the first of the parent div
// div.before("button");
// at the end of the parent div
// div.after("button");