Untitled
Anonymous
Plain Text
09/09/2025 7:51 PM
1.2 KB
16
Indexable
Never
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My To-Do App</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
padding: 20px;
background: #f4f4f4;
}
h1 {
color: #333;
}
input, button {
padding: 10px;
margin: 5px;
font-size: 16px;
}
ul {
list-style: none;
padding: 0;
}
li {
background: white;
margin: 5px 0;
padding: 10px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
</style>
</head>
<body>
<h1>My To-Do List ✅</h1>
<input id="taskInput" type="text" placeholder="Tulis task di sini...">
<button onclick="addTask()">Tambah</button>
<ul id="taskList"></ul>
<script>
function addTask() {
const input = document.getElementById("taskInput");
const task = input.value.trim();
if (task === "") return;
const li = document.createElement("li");
li.textContent = task;
document.getElementById("taskList").appendChild(li);
input.value = "";
}
</script>
</body>
</html>XD XDEditor is loading...
Leave a Comment