Created
February 27, 2026 19:58
-
-
Save YousufProjs-exe/4255fa1b410ad264fe50f9008917249b to your computer and use it in GitHub Desktop.
TASK MANAGER Browser , All three Files i.e, Task-Manager .html ; .css ; .js below ~{ " ITS A DEMO VERSION!! " } ~
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| body { | |
| font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; | |
| background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); | |
| min-height: 100vh; | |
| display: flex; | |
| justify-content: center; | |
| align-items: center; | |
| padding: 20px; | |
| } | |
| .container { | |
| background: white; | |
| border-radius: 15px; | |
| box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2); | |
| padding: 30px; | |
| width: 100%; | |
| max-width: 500px; | |
| } | |
| h1 { | |
| color: #333; | |
| margin-bottom: 20px; | |
| text-align: center; | |
| } | |
| .input-section { | |
| display: flex; | |
| gap: 10px; | |
| margin-bottom: 20px; | |
| } | |
| #taskInput { | |
| flex: 1; | |
| padding: 12px; | |
| border: 2px solid #ddd; | |
| border-radius: 8px; | |
| font-size: 16px; | |
| transition: border-color 0.3s; | |
| } | |
| #taskInput:focus { | |
| outline: none; | |
| border-color: #667eea; | |
| } | |
| #addBtn { | |
| padding: 12px 30px; | |
| background: #667eea; | |
| color: white; | |
| border: none; | |
| border-radius: 8px; | |
| cursor: pointer; | |
| font-weight: bold; | |
| transition: background 0.3s; | |
| } | |
| #addBtn:hover { | |
| background: #764ba2; | |
| } | |
| .task-list { | |
| list-style: none; | |
| } | |
| .task-item { | |
| display: flex; | |
| align-items: center; | |
| gap: 12px; | |
| padding: 15px; | |
| background: #f5f5f5; | |
| border-radius: 8px; | |
| margin-bottom: 10px; | |
| transition: all 0.3s; | |
| } | |
| .task-item:hover { | |
| background: #efefef; | |
| transform: translateX(5px); | |
| } | |
| .task-item input[type="checkbox"] { | |
| width: 20px; | |
| height: 20px; | |
| cursor: pointer; | |
| } | |
| .task-item.completed { | |
| opacity: 0.6; | |
| } | |
| .task-item.completed .task-text { | |
| text-decoration: line-through; | |
| color: #999; | |
| } | |
| .task-text { | |
| flex: 1; | |
| color: #333; | |
| font-size: 16px; | |
| } | |
| .delete-btn { | |
| padding: 8px 12px; | |
| background: #ff6b6b; | |
| color: white; | |
| border: none; | |
| border-radius: 5px; | |
| cursor: pointer; | |
| transition: background 0.3s; | |
| } | |
| .delete-btn:hover { | |
| background: #ff5252; | |
| } | |
| .empty-msg { | |
| text-align: center; | |
| color: #999; | |
| margin-top: 20px; | |
| font-size: 14px; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Task Manager</title> | |
| <link rel="stylesheet" href="Task-Manager.css"> | |
| </head> | |
| <body> | |
| <div class="container"> | |
| <h1> My Tasks </h1> | |
| <div class="input-section"> | |
| <input | |
| type="text" | |
| id="taskInput" | |
| placeholder="Add a new task..." | |
| autocomplete="off" | |
| > | |
| <button id="addBtn">Add Task</button> | |
| </div> | |
| <ul id="taskList" class="task-list"></ul> | |
| <p id="emptyMsg" class="empty-msg">No tasks yet! Add one to get started 🎯</p> | |
| </div> | |
| <script src="Task-Manager.js"></script> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TaskManager { | |
| constructor() { | |
| this.tasks = this.loadFromStorage(); | |
| this.taskInput = document.getElementById('taskInput'); | |
| this.addBtn = document.getElementById('addBtn'); | |
| this.taskList = document.getElementById('taskList'); | |
| this.emptyMsg = document.getElementById('emptyMsg'); | |
| this.addBtn.addEventListener('click', () => this.addTask()); | |
| this.taskInput.addEventListener('keypress', (e) => { | |
| if (e.key === 'Enter') this.addTask(); | |
| }); | |
| this.render(); | |
| } | |
| addTask() { | |
| const text = this.taskInput.value.trim(); | |
| if (!text) { | |
| alert('Please enter a task!'); | |
| return; | |
| } | |
| const task = { | |
| id: Date.now(), | |
| text: text, | |
| completed: false | |
| }; | |
| this.tasks.push(task); | |
| this.saveToStorage(); | |
| this.taskInput.value = ''; | |
| this.render(); | |
| } | |
| deleteTask(id) { | |
| this.tasks = this.tasks.filter(task => task.id !== id); | |
| this.saveToStorage(); | |
| this.render(); | |
| } | |
| toggleTask(id) { | |
| const task = this.tasks.find(t => t.id === id); | |
| if (task) { | |
| task.completed = !task.completed; | |
| this.saveToStorage(); | |
| this.render(); | |
| } | |
| } | |
| saveToStorage() { | |
| localStorage.setItem('tasks', JSON.stringify(this.tasks)); | |
| } | |
| loadFromStorage() { | |
| const saved = localStorage.getItem('tasks'); | |
| return saved ? JSON.parse(saved) : []; | |
| } | |
| render() { | |
| this.taskList.innerHTML = ''; | |
| if (this.tasks.length === 0) { | |
| this.emptyMsg.style.display = 'block'; | |
| return; | |
| } | |
| this.emptyMsg.style.display = 'none'; | |
| this.tasks.forEach(task => { | |
| const li = document.createElement('li'); | |
| li.className = `task-item ${task.completed ? 'completed' : ''}`; | |
| li.innerHTML = ` | |
| <input | |
| type="checkbox" | |
| ${task.completed ? 'checked' : ''} | |
| onchange="taskManager.toggleTask(${task.id})" | |
| > | |
| <span class="task-text">${task.text}</span> | |
| <button class="delete-btn" onclick="taskManager.deleteTask(${task.id})"> | |
| Delete | |
| </button> | |
| `; | |
| this.taskList.appendChild(li); | |
| }); | |
| } | |
| } | |
| // Initialize | |
| const taskManager = new TaskManager(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment