-
Notifications
You must be signed in to change notification settings - Fork 0
/
toDoList.html
40 lines (38 loc) · 1.19 KB
/
toDoList.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<h3>To-DO-List</h3>
<input placeholder="Enter the Task" class="js-task">
<button onclick="addTask(); onkeydown">ADD</button>
<!-- <p class="toDolist"></p> -->
<div class="js-tasks"></div>
<script>
let taskslist = [];
// let html;
function updatedList(){
let toDolisthtml = '';
}
function addTask() {
let toDolisthtml = '';
let innerTask = document.querySelector('.js-task');
let Task = innerTask.value;
console.log(Task)
taskslist.push(Task);
for (let i = 0; i < taskslist.length; i++) {
let html = `<p>${taskslist[i]} <button onclick = "
taskslist.pop(${i})
updatedList();"
>Delete</button></p>`;
console.log(html);
toDolisthtml += html;
}
document.querySelector('.js-tasks').innerHTML = toDolisthtml;
}
</script>
</body>
</html>