Apoorva Tripathi
Apoorva Tripathi
The Task Tracker application is a simple, user-friendly tool designed to help manage tasks effectively.
Built with vanilla JavaScript, HTML, and CSS, it provides basic CRUD (Create, Read, Update, Delete)
operations for tasks.
Setup Instructions
bash
Copy code
mkdir task-tracker
cd task-tracker
o index.html
o styles.css
o script.js
3. Folder Structure
Copy code
task-tracker/
├── index.html
├── styles.css
└── script.js
html
Copy code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Task Tracker</title>
</head>
<body>
<div class="container">
<h1>Task Tracker</h1>
<div class="task-input">
</div>
<ul id="taskList"></ul>
</div>
<script src="script.js"></script>
</body>
</html>
css
Copy code
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
animation: fadeInBackground 1s ease-in-out;
@keyframes fadeInBackground {
from { opacity: 0; }
to { opacity: 1; }
.container {
background-color: #fff;
padding: 20px;
border-radius: 10px;
width: 350px;
text-align: center;
@keyframes fadeInContainer {
h1 {
margin-bottom: 20px;
color: #ff7e5f;
}
.task-input {
display: flex;
justify-content: space-between;
margin-bottom: 20px;
#taskInput {
width: 70%;
padding: 10px;
border-radius: 5px;
outline: none;
#taskInput:focus {
border-color: #ff7e5f;
#addTaskButton {
padding: 10px;
background-color: #ff7e5f;
color: #fff;
border: none;
border-radius: 5px;
cursor: pointer;
#addTaskButton:hover {
background-color: #feb47b;
transform: scale(1.05);
ul {
list-style-type: none;
padding: 0;
li {
background-color: #f9f9f9;
padding: 10px;
margin-bottom: 10px;
border-radius: 5px;
display: flex;
justify-content: space-between;
align-items: center;
@keyframes fadeInTask {
from { transform: translateX(-50px); opacity: 0; }
li .actions {
display: flex;
li .actions button {
background-color: #dc3545;
color: #fff;
border: none;
border-radius: 5px;
margin-left: 5px;
cursor: pointer;
padding: 5px;
li .actions button.edit {
background-color: #007bff;
li .actions button:hover {
opacity: 0.8;
Copy code
document.addEventListener("DOMContentLoaded", function() {
addTaskButton.addEventListener("click", addTask);
taskList.addEventListener("click", handleTaskActions);
function addTask() {
return;
taskList.appendChild(taskItem);
taskInput.value = "";
function createTaskItem(taskText) {
const li = document.createElement("li");
li.textContent = taskText;
actions.classList.add("actions");
const editButton = document.createElement("button");
editButton.textContent = "Edit";
editButton.classList.add("edit");
deleteButton.textContent = "Delete";
actions.appendChild(editButton);
actions.appendChild(deleteButton);
li.appendChild(actions);
return li;
function handleTaskActions(event) {
editTask(taskItem);
deleteTask(taskItem);
}
}
function editTask(taskItem) {
taskItem.firstChild.textContent = newTaskText.trim();
function deleteTask(taskItem) {
taskItem.remove();
});
Functionalities
1. Add Task
o Users can add a new task by entering text in the input field and clicking the "Add
Task" button.
2. Display Tasks
3. Update Task
o Users can edit an existing task by clicking the "Edit" button next to the task.
o A prompt will appear, allowing the user to enter a new task description.
4. Delete Task
o Users can delete a task by clicking the "Delete" button next to the task.
Testing
1. Add Task
o Enter text in the input field and click the "Add Task" button.
2. Edit Task
o Enter a new task description in the prompt and verify that the task updates in the
list.
3. Delete Task