(function(){
const btn = document.querySelector("[data-form-btn]");
const creacionTask = (event) => {
const input = document.querySelector("[data-form-input]");
const task = document.createElement("li");
const list = document.querySelector("[data-list]");
event.preventDefault();
const value = input.value;
input.value = "";
console.log(value);
const taskContent = document.createElement("div");
taskContent.appendChild(checkComplete());
const tittleTask = document.createElement("span");
tittleTask.classList.add("task");
tittleTask.innerHTML = value;
taskContent.appendChild(tittleTask);
const content = `
<i class="fas fa-trash-alt trashIcon icon"></i>`;
task.appendChild(taskContent);
//list.classList.add("cardsList");
task.classList.add("card");
list.appendChild(task);
};
btn.addEventListener("click", creacionTask);
const checkComplete = () => {
const i = document.createElement("i");
i.classList.add("far", "fa-check-square", "icon");
i.addEventListener("click", complete_Task);
return i;
};
const complete_Task = (event) => {
const element = event.target;
element.classList.toggle("fas");
element.classList.toggle("far");
element.classList.toggle("completeIcon");
console.log(event.target);
};
}());