Skip to content

Commit 14697a5

Browse files
committed
Element creation
1 parent a7c91ee commit 14697a5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

Lecture06/DOM/index.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
<body>
1111
<p id="para">Hello </p>
1212
<a id="link"></a>
13+
<ul id="list">
14+
<li>1</li>
15+
</ul>
1316
</body>
1417
<script src="script.js"></script>
1518
</html>

Lecture06/DOM/script.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
let para = document.getElementById('para');
22
let link = document.getElementById('link');
3+
let list = document.getElementById('list')
34

45
para.innerText += " Dhruv";
56

67
link.innerText = "Welcome to Coding Blocks"
78
link.setAttribute('href', 'https://codingblocks.com/')
89

10+
let item = document.createElement('li');
11+
item.innerHTML = 2;
12+
13+
list.appendChild(item)

0 commit comments

Comments
 (0)