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 design
- Responsive Grid System
- Store and Delete items
Prerequisites: Basic knowledge of HTML, CSS, JavaScript, jQuery, and Bootstrap. Also, the user should be aware of how the grid system in Bootstrap works.
Setup: Create three files for HTML, CSS and JavaScript. To create these files run the following command:Â
Â
- Syntax:Â
$ touch index.html index.css index.js
- Â
- Step 1: Now edit index.html file.Â
Â
html
<!DOCTYPE html><html lang="en" dir="ltr">Â
<head>Â Â Â Â <meta charset="utf-8">Â Â Â Â <title>todo</title>Â Â Â Â <link rel="stylesheet" href="style.css">Â Â Â Â Â Â Â <!-- Latest compiled and minified CSS -->Â Â Â Â <link rel="stylesheet" href=</head>Â
<body>Â Â Â Â <div class="container">Â Â Â Â Â Â Â Â <h1 class="row">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â TODO APP Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â </h1>Â Â Â Â Â Â Â Â <br/><br/>Â Â Â Â Â Â Â Â <div class="row">Â Â Â Â Â Â Â Â Â Â Â Â <form class="form-inline col-sm-offset-3">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â <div class="input-group">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â <span class="input-group-addon">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â <i class="glyphicon glyphicon-pencil"></i>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â </span>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â <input type="text" class="form-control"Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â placeholder="todo-item" Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â id="box" style="width: 30vw" />Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â </div>Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â <div class="form-group">Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â <input type="button"Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â class="btn btn-primary form-control" Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â value="add" style="width: 10vw"Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â onclick="add_item()" />Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â </div>Â Â Â Â Â Â Â Â Â Â Â Â </form>Â Â Â Â Â Â Â Â </div>Â Â Â Â Â Â Â Â <div class="row">Â Â Â Â Â Â Â Â Â Â Â Â <ul id="list_item">Â Â Â Â Â Â Â Â Â Â Â Â </ul>Â Â Â Â Â Â Â Â </div>Â Â Â Â </div>Â Â Â Â <script type="text/javascript" src="main.js"></script></body>Â
</html> |
- Step 2: Now, add some CSS property to index.css file.Â
Â
CSS
* {Â Â Â Â padding: 0;Â Â Â Â margin: 0;Â Â Â Â box-sizing: border-box;Â Â Â Â font-family: cursive;Â Â }Â Â Â Â Â body {Â Â Â Â background: #f2f2f2;Â Â Â Â overflow: auto;Â Â }Â Â Â Â Â h1{Â Â Â Â Â text-align: center;Â Â Â Â Â margin: 5%;Â Â Â Â Â font-size: 3rem;Â Â Â Â Â text-decoration: underline;Â Â }Â Â Â Â Â ul {Â Â Â Â text-align: left;Â Â Â Â padding-left: 10%;Â Â Â Â padding: 7%;Â Â Â Â font-size: 2rem;Â Â Â Â list-style: circle;Â Â }Â Â Â Â Â li:hover{Â Â Â Â color:red;Â Â Â Â margin: 4%;Â Â Â Â transition: 1.5s ease;Â Â Â Â cursor: pointer;Â Â }Â Â |
- Step 3: Edit index.js file and add some functionality.Â
Â
javascript
// Function called while clicking add buttonfunction add_item() {Â
  // Getting box and ul by selecting id;  let item = document.getElementById("box");  let list_item = document.getElementById("list_item");  if(item.value != ""){Â
      // Creating element and adding value to it      let make_li = document.createElement("LI");      make_li.appendChild(document.createTextNode(item.value));Â
      // Adding li to ul      list_item.appendChild(make_li);Â
      // Reset the value of box      item.value=""             // Delete a li item on click       make_li.onclick = function(){        this.parentNode.removeChild(this);      }Â
  }  else{Â
    // Alert msg when value of box is "" empty.    alert("plz add a value to item");  }Â
} |
- Output:
Â
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, zambiatek Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!




