From 69221f8308d50e406a1a86f732e4e337320ec25f Mon Sep 17 00:00:00 2001 From: WhyKorp <117651228+whykorp@users.noreply.github.com> Date: Mon, 11 Mar 2024 01:02:57 +0100 Subject: [PATCH] Todo List prototype --- ruty/js/scripttodo.js | 45 +++++++++++++++++++++++++++++++++++++++++++ ruty/todo.php | 28 +++++++++++++++++++++++---- 2 files changed, 69 insertions(+), 4 deletions(-) diff --git a/ruty/js/scripttodo.js b/ruty/js/scripttodo.js index 0d6db4b..61e91f2 100644 --- a/ruty/js/scripttodo.js +++ b/ruty/js/scripttodo.js @@ -15,3 +15,48 @@ menuTrigger.addEventListener("click", () => { overlay.style.display = "block"; } }); + +// Todo +document.addEventListener("DOMContentLoaded", function() { + const newTodoInput = document.getElementById("new-todo"); + const addTodoButton = document.getElementById("add-todo"); + const todoList = document.getElementById("todo-list"); + + const newTagInput = document.getElementById("new-tag"); + const addTagButton = document.getElementById("add-tag"); + const tagList = document.getElementById("tag-list"); + + const newCategoryInput = document.getElementById("new-category"); + const addCategoryButton = document.getElementById("add-category"); + const categoryList = document.getElementById("category-list"); + + addTodoButton.addEventListener("click", function() { + const todoText = newTodoInput.value.trim(); + if (todoText !== "") { + const todoItem = document.createElement("li"); + todoItem.textContent = todoText; + todoList.appendChild(todoItem); + newTodoInput.value = ""; + } + }); + + addTagButton.addEventListener("click", function() { + const tagText = newTagInput.value.trim(); + if (tagText !== "") { + const tagItem = document.createElement("li"); + tagItem.textContent = tagText; + tagList.appendChild(tagItem); + newTagInput.value = ""; + } + }); + + addCategoryButton.addEventListener("click", function() { + const categoryText = newCategoryInput.value.trim(); + if (categoryText !== "") { + const categoryItem = document.createElement("li"); + categoryItem.textContent = categoryText; + categoryList.appendChild(categoryItem); + newCategoryInput.value = ""; + } + }); +}); diff --git a/ruty/todo.php b/ruty/todo.php index 3660223..2f68699 100644 --- a/ruty/todo.php +++ b/ruty/todo.php @@ -10,9 +10,29 @@

Ruty

+ +
+
+

Add a Task

+ + +
+
+

Todos

+ +
+ +
- - + - - \ No newline at end of file +