-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
31 lines (24 loc) · 786 Bytes
/
app.js
File metadata and controls
31 lines (24 loc) · 786 Bytes
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
let arrItems = [];
let btn = document.getElementById("btnSubmit");
let input = document.querySelector(".input");
btn.addEventListener("click", () => {
let newTask = input.value;
input.value = "";
arrItems.push(newTask);
console.log(arrItems);
// throwIt();
});
let i = 1;
arrItems.forEach(function(item){
let div = document.createElement("div");
div.classList.add("item-group");
let h4 = document.createElement("h4");
let btnDel = document.createElement("button");
btnDel.classList.add("button-delete");
btnDel.textContent = "X";
h4.innerText = i + ". " + item;
div.append(h4);
div.append(btnDel);
document.querySelector(".customField").append(div);
i++;
});