Professional Documents
Culture Documents
getElementById("title");
const descriptionInput = document.getElementById("description");
const lowPriorityButton = document.getElementById("low");
const mediumPriorityButton = document.getElementById("medium");
const highPriorityButton = document.getElementById("high");
const saveButton = document.getElementById("save-button");
const cancelButton = document.getElementById("cancel-button");
const todoList = document.querySelector(".todo-list");
const TaskPriority = {
LOW: "Low",
MEDIUM: "Medium",
HIGH: "High",
};
const TaskColorIndicator = {
LOW: "white",
MEDIUM: "#FCFBE4",
HIGH: "#FFEEEE",
};
saveButton.disabled = true;
if (mediumPriorityButton.checked) {
priority = TaskPriority.MEDIUM;
} else if (highPriorityButton.checked) {
priority = TaskPriority.HIGH;
}
const todoObject = {
id,
title,
description,
priority,
createdAt: new Date(),
completed: false,
};
todos.push(todoObject);
titleInput.value = "";
descriptionInput.value = "";
lowPriorityButton.checked = true;
renderTodoObjects();
};
if (completed) {
/* todoObject.style.backgroundColor = "lightgreen"; */
todoObject.style.textDecoration = "line-through";
}
todoObject.appendChild(contentEl);
optionsObject.appendChild(trashObject);
optionsObject.appendChild(checkboxButtonObject);
todoObject.appendChild(optionsObject);
todoList.appendChild(todoObject);
});
};
titleInput.addEventListener("input", updateSaveButton);
descriptionInput.addEventListener("input", updateSaveButton);
saveButton.addEventListener("click", addTodo);
cancelButton.addEventListener("click", () => {
titleInput.value = "";
descriptionInput.value = "";
lowPriorityButton.checked = true;
});
renderTodoObjects();