forked from PromoSncfToulouse2022-2023/todo-list
-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
51 lines (34 loc) · 1.13 KB
/
script.js
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
// This is the array that will hold the todo list items
let todoItems = [];
function addTodo(text)
{
// This function will create a new todo object based on the
// text that was entered in the text input, and push it into
// the `todoItems` array
}
function renderTodo(todo)
{
// Select the first element with a class of `js-todo-list`
// Create an `li` element and assign it to the`ul`
// Set the contents of the `li` element created above
// Append the element to the DOM as the last child of
// the element referenced by the `list` variable
}
function toggleDone(key)
{
// Locate the todo item in the todoItems array and set its checked
// property to the opposite. That means, `true` will become `false` and vice
// versa.
}
// Select the form element
const form = document.getElementById("todo-form");
// Add a submit event listener
form.addEventListener('submit', event =>
{
// prevent page refresh on form submission
event.preventDefault();
console.log(event);
// select the text input
// Get the value of the input
// send the value to the addTodo function
});