Make A Todo list using javascript example

Hello Guys,

In this article you will learn how to create Todo List using JavaScript. JavaScript Todo List helps you create a list of things you want to do throughout the day. Suppose you want to do something throughout the day that you can list here. Whenever you complete that task then you can delete it.

I have taken HTML, CSS and JavaScript help to create this Todo List. html and css helped to design it and JavaScript made it work.

In this example to first make a inside your project folder to make assets/css/custom.css file

Demo Todo List : Source Code :
<!DOCTYPE html>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>Todo List Pratical</title>
	<link rel="stylesheet" href="assets/css/custom.css"/>
    <link rel="stylesheet" href="">
    <script src=""></script>	

<div class="todoMainDiv">
	<div id="todoDiv" class="header">
	  	<h2 style="padding-top:15px;color: #fff;">Custom To Do List</h2>
	  	<div id="newtask">
	        <input type="text" placeholder="To Do Head...." id="text-value" onclick= "clearInput()">
	        <button id="addTodo">Add</button>

	<ul id="todo-ul">

<script type="text/javascript">
function clearInput(){
  	var getValue= document.getElementById("text-value");
    if (getValue.value !="") {
        getValue.value = "";

function addToDoList() {	
	let array = [];
	let obj = {
	 	name: document.querySelector('#newtask input').value
    document.querySelector('#text-value').innerHTML = '';

//  appendTodo list
function appendTodo(obj) {
  	const list = document.querySelector('#todo-ul');
  	const liObj = document.createElement("li");

  	liObj.innerHTML = 
  	`<div class="task">
        <span id="todoname">
            ${document.querySelector('#newtask input').value}
        <span class="delete">x</span> 

document.querySelector('#addTodo').onclick = function(){
    if(document.querySelector('#newtask input').value.length == 0){
        alert("Please Enter Task Name")

		var delete_todo = document.querySelectorAll(".delete");

// delete todo list
function deleteToDoList(delete_todo) {
    for(var i=0; i<delete_todo.length; i++){
        delete_todo[i].onclick = function(){
        	var div = this.parentNode;

// compleate todo list
var list = document.querySelector('ul');
function compleateTodoList(list) {
	list.addEventListener('click', function(ev) {
	  if ( === 'LI') {'checked');
	}, false);

I hope you understand of how to make todo list using javascript...