How to Save To-Do List Data in Local Storage Using JavaScript

//list is an id in ul
 const listContainer = document.getElementById("list");

function saveData(){
//can save data to browser storage
localStorage.setItem("data",listContainer.innerHTML);
}

function showData() {
//can show data that we save in browser storage
 listContainer.innerHTML = localStorage.getItem("data")
        }
        showData();

## Conclusion

Practice by building small projects. It helps you improve and learn faster.

**Happy Coding!**
0
Subscribe to my newsletter

Read articles from Ruwanthika Dilrukshi directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ruwanthika Dilrukshi
Ruwanthika Dilrukshi

Hi! 👋 I’m Ruwanthika, an aspiring Software Engineer from Sri Lanka, currently studying Information Technology at the University of Colombo School of Computing. I’m passionate about web development, especially working with HTML, CSS, JavaScript, Bootstrap, jQuery, and Java Spring Boot. On this blog, I share simple tutorials, coding tips, and beginner-friendly projects to help others who are learning like me. Follow me if you're interested in: Web development tutorials Beginner coding projects Tips for learning programming I’m also working on real-world software projects for distributors and pet care management systems as my academic project. 💻 Let’s learn and grow together!