-
Notifications
You must be signed in to change notification settings - Fork 65
/
script.js
30 lines (25 loc) · 947 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
29
30
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 = '';
//backticks
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);