-
Notifications
You must be signed in to change notification settings - Fork 0
/
lecture26.html
72 lines (63 loc) · 3.72 KB
/
lecture26.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Lecture 26 | JavaScript DOM Manipulation</title>
</head>
<body>
*****************************Tutorial Start 🔥 ********************************
<div id="main">
<!--- Dynamic insert div element as a first child/previous, using insertbefore() function-->
<h1 id="heading">JavaScript DOM Manipulation</h1>
<p id="para">Lorem ipsum dolor sit amet consectetur adipisicing elit. Hic vel veniam at, veritatis repudiandae quos neque alias adipisci fuga in accusantium perspiciatis deserunt!</p>
<!--- Dynamic add Div Element as a last child, using createTextNode() and appendChild() function-->
<!---Replace Child node example-->
<ul id="myListItem"><li>Tea</li><li>Biscuit</li><li>Pizza</li></ul>
</div>
<button onclick="addNode()">Click Here To Add New Node Dynamically</button>
__________
| Document | --> root node (kisi bhi page ka root node document hota hai, and iske help se hum page ke pure
elements ko access kar sakte hai.)
|__________|
|
|
|
__________
| <html> | -->parent
|________|
|
|
_________________________________________________________________
| |
| |
________ _________
| <head> | --> html ka child hai ye | <body> | --> html ka child hai ye
|________| |_________|
| --> ye sab hamare nodes hai, basically DOM object hai |
| |
| _________________________________________
| | |
________ ________ ________
| <title>| | <div> | --> body ka div child hai ye | <ul> | --> body ka ul child hai ye
|________| |________| |________|
| div id="main"
|
______________________________
| |
| id="title" | id="para"
________ ________
| <h1> | | <p> |
|________| |________|
<h4>Kisi bhi elements ko dynamically </h4>
<li>Add karna</li>
<li>Remove Karna</li>
<li>Replace Karna</li>
<li>Create Karna</li>
<p>Hum apne html page me har jagah append kar sakte hai dynamically with the help of DOM Manipulation.</p>
<p>Hum kisi bhi node ka dynamically add,delete, replace kar sakte hai, node means, div, p, h1, and other html tags, with help of DOM Manipulation.</p>
<script src="lecture26.js"></script>
***************************** Tutorial End 🚀 ********************************
</body>
</html>