Todo List
Todo List
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<div class="col-md-6">
<form id="todo-form">
<div class="input-group-append">
</div>
</div>
</form>
</div>
</div>
<div class="col-md-6">
</div>
</div>
</div>
<div class="col-md-6">
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js"></
script>
<script src="script.js"></script>
</body>
</html>
body {
min-height: 100vh;
.container {
padding-bottom: 50px;
h1 {
color: #2c3e50;
font-weight: 300;
#todo-list .list-group-item {
border: none;
border-radius: 15px;
margin-bottom: 10px;
#todo-list .list-group-item:hover {
transform: translateY(-2px);
#todo-list .list-group-item.completed {
text-decoration: line-through;
color: #666;
.delete-btn {
opacity: 0;
opacity: 1;
.btn-group .btn {
}
.btn-group .btn.active {
background-color: #007bff;
color: white;
$(document).ready(function() {
renderTasks();
$('#todo-form').submit(function(e) {
e.preventDefault();
if (taskText) {
saveTasks();
renderTasks();
$('#todo-input').val('');
});
// Toggle task completion
tasks[index].completed = !tasks[index].completed;
saveTasks();
renderTasks();
});
// Delete task
e.stopPropagation();
tasks.splice(index, 1);
saveTasks();
renderTasks();
});
// Filter tasks
$('.btn-group .btn').click(function() {
$(this).addClass('active').siblings().removeClass('active');
renderTasks();
});
function renderTasks() {
$('#todo-list').empty();
.text(task.text)
.data('index', index);
if (task.completed) {
listItem.addClass('completed');
.html('×');
listItem.append(deleteBtn);
$('#todo-list').append(listItem);
listItem.hide().slideDown(300);
});
function saveTasks() {
localStorage.setItem('tasks', JSON.stringify(tasks));
});
This implementation creates an interactive and visually appealing to-do list with the following features:
The design uses a gradient background and card-like task items for a modern look. Animations and
transitions provide a fluid user experience. The code structure allows for easy maintenance and future
enhancements.