-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
28 lines (20 loc) · 823 Bytes
/
main.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
import FinishButton from './componentes/finishTask.js';
import DeleteButton from './componentes/deleteTask.js';
const createTask = (evento) => {
evento.preventDefault();
const list = document.querySelector('[data-list]');
const input = document.querySelector('[data-form-input]');
const valor = input.value;
const flex = document.createElement('div');
const task = document.createElement('li');
task.classList.add('task');
const content = `<p class="content">${valor}</p>`;
task.innerHTML = content;
list.appendChild(task);
task.appendChild(flex);
task.appendChild(FinishButton());
task.appendChild(DeleteButton());
input.value = "";
}
const newTask = document.querySelector('[data-form-button]');
newTask.addEventListener('click', createTask);