Develop a fully-featured To-Do app from scratch using only vanilla JavaScript—perfect for sharpening your core JS skills.. Perfect for beginners who want to practice DOM manipulation and event handling.
Premium Article
Published 5 months ago
Build a To-Do List in JavaScript – Beginner Friendly with Source Code
5 min read
91 views

Photo by Techquestworld
<!DOCTYPE html>
<html>
<head>
<title>To-Do List</title>
</head>
<body>
<h2>My To-Do List</h2>
<input type="text" id="task" placeholder="Add new task">
<button onclick="addTask()">Add</button>
<ul id="taskList"></ul>
<script>
function addTask() {
const taskText = document.getElementById("task").value;
if (taskText === "") return;
const li = document.createElement("li");
li.textContent = taskText;
li.onclick = () => li.remove();
document.getElementById("taskList").appendChild(li);
document.getElementById("task").value = "";
}
</script>
</body>
</html>