This media is not supported in your browser
VIEW IN TELEGRAM
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Todo List</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background: white;
padding: 2rem;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
h2 {
text-align: center;
margin-bottom: 1rem;
}
input[type="text"] {
width: 100%;
padding: 0.5rem;
margin-bottom: 1rem;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
width: 100%;
padding: 0.5rem;
border: none;
background: #28a745;
color: white;
border-radius: 5px;
cursor: pointer;
}
ul {
list-style: none;
padding: 0;
}
li {
background: #f9f9f9;
padding: 0.5rem;
margin-bottom: 0.5rem;
display: flex;
justify-content: space-between;
align-items: center;
border-radius: 5px;
}
.delete-btn {
background: #dc3545;
color: white;
border: none;
border-radius: 5px;
padding: 0.2rem 0.5rem;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<h2>Todo List</h2>
<input type="text" id="taskInput" placeholder="Add a new task..." />
<button onclick="addTask()">Add Task</button>
<ul id="taskList"></ul>
</div>
<script>
function addTask() {
const taskInput = document.getElementById('taskInput');
const taskText = taskInput.value.trim();
if (taskText === '') return;
const li = document.createElement('li');
li.innerHTML =
document.getElementById('taskList').appendChild(li);
taskInput.value = '';
}
function deleteTask(btn) {
btn.parentElement.remove();
}
</script>
</body>
</html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Todo List</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.container {
background: white;
padding: 2rem;
border-radius: 10px;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
width: 300px;
}
h2 {
text-align: center;
margin-bottom: 1rem;
}
input[type="text"] {
width: 100%;
padding: 0.5rem;
margin-bottom: 1rem;
border: 1px solid #ccc;
border-radius: 5px;
}
button {
width: 100%;
padding: 0.5rem;
border: none;
background: #28a745;
color: white;
border-radius: 5px;
cursor: pointer;
}
ul {
list-style: none;
padding: 0;
}
li {
background: #f9f9f9;
padding: 0.5rem;
margin-bottom: 0.5rem;
display: flex;
justify-content: space-between;
align-items: center;
border-radius: 5px;
}
.delete-btn {
background: #dc3545;
color: white;
border: none;
border-radius: 5px;
padding: 0.2rem 0.5rem;
cursor: pointer;
}
</style>
</head>
<body>
<div class="container">
<h2>Todo List</h2>
<input type="text" id="taskInput" placeholder="Add a new task..." />
<button onclick="addTask()">Add Task</button>
<ul id="taskList"></ul>
</div>
<script>
function addTask() {
const taskInput = document.getElementById('taskInput');
const taskText = taskInput.value.trim();
if (taskText === '') return;
const li = document.createElement('li');
li.innerHTML =
${taskText} <button class="delete-btn" onclick="deleteTask(this)">X</button>
;document.getElementById('taskList').appendChild(li);
taskInput.value = '';
}
function deleteTask(btn) {
btn.parentElement.remove();
}
</script>
</body>
</html>