Skip to content

MAHMOUD128/Todo-list

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Todo-List Project

100%

This project is written in HTML, CSS and Javascript that help me to finish the tasks.

Result:

img


Code:

Functions

1- To add task addTask()

First check if the input is empty or not, if empty,the window out alert, if not empty, the window will add a task
function addTask(){
   if(inputBox.value === ""){
       alert("Please Enter a Task");
   }
   else{
       let li = document.createElement("li");
       li.innerText = inputBox.value;
       listContainer.appendChild(li);
       let span = document.createElement("span");
       span.innerText = "\u00D7";
       li.appendChild(span);
   }
   inputBox.value = "";
   saveData();

}

2- To save data in local storage saveData()

This function is used to save user data to the page's local storage
 function saveData(){
     localStorage.setItem("data", listContainer.innerHTML);
 }

3- To show data from local storage showData()

This function is used to show user data from the page's local storage
 function showData(){
    listContainer.innerHTML = localStorage.getItem("data");
}

Live Demo:

you can view live demo from here


Accounts:

Linkedin Account

LeetCode Account

About

Create a todo-list page with html & css & js

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published