-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
31 lines (24 loc) · 969 Bytes
/
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
import checkComplete from "./components/checkComplete.js";
import deleteIcon from "./components/deleteIcon.js";
const btn = document.querySelector("[data-form-btn]");
const createTask = (evento) => {
evento.preventDefault();
const input = document.querySelector("[data-form-input]");
const value = input.value;
const list = document.querySelector("[data-list]");
const task = document.createElement('li');
task.classList.add('card');
input.value = '';
const taskContent = document.createElement('div');
const titleTask = document.createElement('span');
titleTask.classList.add('task');
titleTask.innerText = value;
taskContent.appendChild(checkComplete());
taskContent.appendChild(titleTask);
//task.innerHTML = content;
task.appendChild(taskContent);
task.appendChild(deleteIcon());
list.appendChild(task);
};
//Arrow functions o funciones anonimas
btn.addEventListener ('click', createTask);