-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtodo.html
39 lines (34 loc) · 860 Bytes
/
todo.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Todo</title>
<style>
div{
text-align: center;
}
</style>
</head>
<body>
<div>
<h2>Todo app</h2>
<input type="text" placeholder="Enter Tasks" />
<button>Add Task</button>
<ul >
<li>Eat</li>
</ul>
</div>
<script>
let btn = document.querySelector("button");
let ul = document.querySelector("ul");
let inp = document.querySelector("input");
btn.addEventListener("click", function () {
let item = document.createElement("li");
item.innerText = inp.value;
ul.appendChild(item);
inp.value = "";
});
</script>
</body>
</html>