Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • BS5 Tutorial
  • BS5 Interview Questions
  • BS5 Layout
  • BS5 Content
  • BS5 Components
  • BS5 Helpers
  • BS5 Utilities
  • BS4 Tutorial
  • BS Tutorial
  • Bootstrap Cheatsheet
  • Tailwind
  • CSS Frameworks
  • HTML Formatter
Open In App
Next Article:
How to Create ToDo App using HTML, CSS, JS and Bootstrap ?
Next article icon

Create a To Do List using Bootstrap 5

Last Updated : 24 Apr, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

A To-Do List is a tool for organizing tasks, allowing users to list, prioritize, and manage their activities, ensuring efficiency and productivity in completing them. Here we will create a ToDo list using Bootstrap. We will create our layout or component using Bootstrap predefined utilities and components. We will add custom JavaScript for the behavior of the to-do list.

Preview:

gfg

Approach

  • We are creating an input field with the help of Bootsrap input-group.
  • Then we are creating a list-group that will add out to do list into it.
  • we are creating a submit button that will add the task into the list. we are writing our logic to add the task into list in the javascript.
  • On submiting the typed text into the input field the function will be called and it will add the task into the list that was created before by the use of bootstrap.
  • Also, it will add two buttons with the task, one button is for editing the task and another one is for deleting the task.
  • If user clicks the editing button it will unable to option to edit the task by calling a function and that editing button will change itno save button after editing the user can save that.
  • If the user clicks the delete button it will call the function and it will remove the task from the list.
  • as the project does not using any kind of storage so it will be disappear once the browser will reload.
  • We have shown three default task at the first so that user can make changes by using those task to check the working of the app.

CDN link:

"https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js

Example: This example shows the implementation of the above-explained approach.

HTML
<!DOCTYPE html> <html lang="en">  <head>     <meta charset="UTF-8">     <meta name="viewport" content="width=device-width, initial-scale=1.0">     <title>To Do List</title>     <!-- Bootstrap CSS -->     <link href= "https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"            rel="stylesheet"> </head>  <body>     <div class="container mt-5">         <h1 class="text-center mb-4">To Do List</h1>         <div class="row justify-content-center">             <div class="col-md-8">                 <div class="card">                     <div class="card-body">                         <form id="todo-form">                             <div class="input-group mb-3">                                 <input type="text" class="form-control"                                        id="todo-input"                                         placeholder="Add new task"                                     required>                                 <button class="btn btn-primary" type="submit">                                       Add                                   </button>                             </div>                         </form>                         <ul class="list-group" id="todo-list">                             <!-- Tasks will be added here dynamically -->                         </ul>                     </div>                 </div>             </div>         </div>     </div>      <!-- Bootstrap JS Bundle (popper.js included) -->     <script src= "https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js">       </script>     <script>         // Function to add a new task         function addTask(task) {             const todoList = document.getElementById("todo-list");             const li = document.createElement("li");             li.className = "list-group-item d-flex justify-content-between align-items-center";             li.innerHTML = `         <span class="task-text">${task}</span>         <input type="text" class="form-control edit-input" style="display: none;" value="${task}">         <div class="btn-group">           <button class="btn btn-danger btn-sm delete-btn">&#x2715;</button>           <button class="btn btn-primary btn-sm edit-btn">&#9998;</button>         </div>       `;             todoList.appendChild(li);         }          // Event listener for form submission         document.getElementById("todo-form").addEventListener("submit",             function (event) {                 event.preventDefault();                 const taskInput = document.getElementById("todo-input");                 const task = taskInput.value.trim();                 if (task !== "") {                     addTask(task);                     taskInput.value = "";                 }             });          // Event listener for delete button click         document.getElementById("todo-list").addEventListener("click",             function (event) {                 if (event.target.classList.contains("delete-btn")) {                     event.target.parentElement.parentElement.remove();                 }             });          // Event listener for edit button click         document.getElementById("todo-list").addEventListener("click", function (event) {             if (event.target.classList.contains("edit-btn")) {                 const taskText = event.target.parentElement                     .parentElement.querySelector(".task-text");                 const editInput = event.target.parentElement                     .parentElement.querySelector(".edit-input");                 if (taskText.style.display !== "none") {                     taskText.style.display = "none";                     editInput.style.display = "block";                     editInput.focus();                     event.target.innerHTML = "&#10004;";                 } else {                     taskText.textContent = editInput.value;                     taskText.style.display = "inline";                     editInput.style.display = "none";                     event.target.innerHTML = "&#9998;";                 }             }         });          // Add default tasks         const defaultTasks = ["HTML", "CSS", "JS", "Bootstrap"];         defaultTasks.forEach(task => addTask(task));     </script> </body>  </html> 

Output:

gfg


Next Article
How to Create ToDo App using HTML, CSS, JS and Bootstrap ?

G

geekcoder2298
Improve
Article Tags :
  • Project
  • Web Technologies
  • Bootstrap
  • Dev Scripter
  • Bootstrap-5
  • Dev Scripter 2024

Similar Reads

  • How to create a Simple Footer using Bootstrap 5 ?
    Bootstrap 5 Footers can be used for displaying Contact links, Social media links, Service links, Company Logos, and other sections. The <footer> tag can be used with built-in classes for making the responsive footer layout. For accomplishing this task, there are 2 approaches, i.e., by using Bo
    4 min read
  • How to create a web page using Bootstrap ?
    Bootstrap is an open-source CSS framework for creating a responsive and customizable frontend for websites and web applications. Using Bootstrap's grid system one can easily create a web page very fast. Any webpage these days needs to have a navbar for user navigation, some content & a form for
    6 min read
  • How to create multi step progress bar using Bootstrap ?
    In this article, we will create a multi-step progress bar using Bootstrap. In addition to Bootstrap, we will use jQuery for DOM manipulation. Progress bars are used to visualize the quantity of work that's been completed. The strength of the progress bar indicates the progress of the work. It is gen
    4 min read
  • How to Create ToDo App using HTML, CSS, JS and Bootstrap ?
    We will create a basic todo app to understand the basics of JavaScript. In this web app, one can create a todo list and can remove specific elements from the list.Features or Functionalities to implement:   Interactive and Responsive designResponsive Grid SystemStore and Delete itemsPrerequisites: B
    2 min read
  • How to create a bootstrap tooltip using jQuery ?
    Tooltip is like a balloon or also a small screen tip that displays text descriptions to any object in a webpage. A tooltip is displayed when the user hovers over an object using the cursor. It is a very useful part of a website and now can be found in almost all websites including some web applicati
    4 min read
  • How to create Call to Action Template using Bootstrap 5 ?
    In this article, we will create a Call to Action (CTA) Template using Bootstrap 5. The main purpose of a Bootstrap Call to Action(CTA) template is to encourage the user to perform a specific action when the user visits the webpage. A simple CTA may consist of the image, content, button, etc, that wi
    2 min read
  • Bootstrap 5 List group Using data Attributes
    Bootstrap 5 List group Using data attributes allows you to add your own information to tags. The data-* attributes can be used to define our own custom data attributes. It is used to store custom data in private on the page or application. In the List group, using data attributes is the sub-topic of
    2 min read
  • How to Create a Basic Two-Column Layout using Bootstrap 5 ?
    To create a basic two-column layout using Bootstrap, first, we have to enclose your content within a container, then create two divs with classes like col or col-xx, where xx represents the breakpoint for responsive behavior. Place your content inside these columns, and Bootstrap will handle the lay
    3 min read
  • Create a To-Do List App using React Redux
    A To-Do list allows users to manage their tasks by adding, removing, and toggling the completion status for each added item. It emphasizes a clean architecture, with Redux state management and React interface rendering. Prerequisites Node.jsReactReact-ReduxApproachCreate a new React project using Cr
    3 min read
  • How to Create Multipage Website Using Bootstrap?
    To create a multipage website using Bootstrap and HTML structure utilize Bootstrap's navbar component to create navigation links between pages. Incorporate Font Awesome icons for visual enhancements and use Bootstrap classes for responsive design. Output Preview: ApproachFirst, create a basic HTML s
    5 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences