Calculator Tools Calculator Tools
Create

Colorful To-Do List App

May 19, 2025

About this app

A fun and interactive to-do list app with colorful design, smooth animations and useful features to enhance productivity.

Colorful To-Do List App Colorful To-Do List Add Task

Related apps

Put this on your site

Source

                    <html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1">

<title>Colorful To-Do List App</title>
<meta name="description" content="A fun and interactive to-do list app with colorful design, smooth animations and useful features to enhance productivity.">
<meta name="keywords" content="to-do, todo, productivity, list, tasks, colorful, fun, application">

<!-- Libraries -->
<!-- jQuery (3.6.0) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js" crossorigin="anonymous"></script>
<!-- Bootstrap CSS (5.3.3) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" crossorigin="anonymous">
<!-- Bootstrap JS (5.3.3) -->
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.min.js" crossorigin="anonymous">
</script>
<!-- Font Awesome (6.6.0) -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.6.0/css/fontawesome.min.css" crossorigin="anonymous">

<script type="text/javascript">
try {
// App Javascript Goes Here. Place your entire script content inside the try block for error handling.

let tasks = [];

document.addEventListener("DOMContentLoaded", function() {
const taskInput = document.getElementById('task-input');
const taskList = document.getElementById('task-list');
const submitButton = document.getElementById('submit-button');

submitButton.addEventListener('click', function() {
const taskText = taskInput.value;
if (taskText) {
addTask(taskText);
taskInput.value = ''; // Clear input
}
});

function addTask(task) {
tasks.push(task);
renderTasks();
}

function deleteTask(index) {
tasks.splice(index, 1);
renderTasks();
}

function renderTasks() {
taskList.innerHTML = '';
tasks.forEach((task, index) => {
const li = document.createElement('li');
li.className = "list-group-item d-flex justify-content-between align-items-center";
li.textContent = task;
const deleteButton = document.createElement('button');
deleteButton.className = "btn btn-danger btn-sm";
deleteButton.innerHTML = '<i class="fas fa-trash-alt"></i>';
deleteButton.onclick = () => deleteTask(index);
li.appendChild(deleteButton);
taskList.appendChild(li);
});
}
});

} catch (error) {
// This will throw the error to the parent window.
throw error;
}
</script>

<style>
body {
background: linear-gradient(to right, #ff5f6d, #ffc371);
color: #333;
font-family: 'Arial', sans-serif;
}
#main-container {
padding: 20px;
border-radius: 10px;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
background-color: #fff;
margin-top: 50px;
}
input[type="text"] {
border-radius: 25px;
padding: 10px;
border: 1px solid #ccc;
margin-right: 10px;
}
button {
border-radius: 25px;
}
.list-group-item {
transition: background 0.3s ease;
}
.list-group-item:hover {
background-color: #f1f1f1;
}
.btn-danger {
margin-left: 10px;
}
h1 {
text-align: center;
color: #6a1b9a;
}
</style>
</head>
<body>
<div id="main-container" class="container">
<h1>Colorful To-Do List</h1>
<div class="input-group mb-3">
<input id="task-input" type="text" class="form-control" placeholder="Add a new task...">
<button id="submit-button" class="btn btn-primary">Add Task</button>
</div>
<ul id="task-list" class="list-group"></ul>
</div>
</body>
</html>