forked from ZoeFM/deepseekv9
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
41 lines (36 loc) · 1.33 KB
/
Copy pathindex.html
File metadata and controls
41 lines (36 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>To-Do List App</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>My To-Do List</h1>
<div>
<input type="text" id="task-input" placeholder="Enter a new task">
<button id="add-task-btn">Add Task</button>
</div>
<ul id="task-list"></ul>
<script>
document.getElementById('add-task-btn').addEventListener('click', function() {
const taskInput = document.getElementById('task-input');
const taskText = taskInput.value.trim();
if (taskText !== '') {
const taskItem = document.createElement('li');
taskItem.className = 'task-item';
taskItem.innerHTML = `
<span>${taskText}</span>
<button class="delete-btn">Delete</button>
`;
taskItem.querySelector('.delete-btn').addEventListener('click', function() {
taskItem.remove();
});
document.getElementById('task-list').appendChild(taskItem);
taskInput.value = '';
}
});
</script>
</body>
</html>