-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathscript.js
More file actions
54 lines (34 loc) · 1.36 KB
/
Copy pathscript.js
File metadata and controls
54 lines (34 loc) · 1.36 KB
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
function completedItemsList(item) {
const newListItem = document.createElement("li");
newListItem.innerHTML = item;
const newInput = document.createElement("input");
newInput.classList.add("form-check-input");
newInput.setAttribute("type", "checkbox");
newListItem.appendChild(newInput)
newListItem.className = "list-group-item"
const list = document.querySelector("#complete-items")
// append to list
list.appendChild(newListItem)
}
completedItemsList(todoItems[0].title)
completedItemsList(todoItems[1].title)
completedItemsList(todoItems[2].title)
function incompletedItemsList(item) {
const newListItem = document.createElement("li");
newListItem.innerHTML = item;
const newInput = document.createElement("input");
newInput.classList.add("form-check-input");
newInput.setAttribute("type", "checkbox");
newListItem.appendChild(newInput)
newListItem.className = "list-group-item"
const list = document.querySelector("#incomplete-items")
// append to list
list.appendChild(newListItem)
}
incompletedItemsList(todoItems[0].title)
incompletedItemsList(todoItems[1].title)
incompletedItemsList(todoItems[2].title)
const newItemForm = document.querySelector("todoItems.title")
newItemForm.addEventListener('submit', function(event) {
event.preventDefault()
})