generated from Digitalni-akademie-Web-Jaro-2020-Praha/Ukol-ukolnicek
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
33 lines (27 loc) · 744 Bytes
/
index.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
'use strict';
const tasks = [];
const todo__tasksElm = document.querySelector('.todo__tasks');
const newTaskElm = document.querySelector('#new-task');
const btnElm = document.querySelector('.btn-add');
const updateTasks = () => {
todo__tasksElm.innerHTML = '';
for (let i = 0; i < tasks.length; i++) {
todo__tasksElm.innerHTML +=
`<div class="task">
${tasks[i]}
</div>`
}
};
const newTask = () => {
if (newTaskElm.value.trim() !== '') {
tasks.push(newTaskElm.value);
}
updateTasks();
newTaskElm.value = '';
};
btnElm.addEventListener('click', newTask);
// const btnPointer = () => {
// const buttonElm = document.querySelector('button');
// buttonElm.style.cursor = "pointer";
// }
// btnPointer();