Answers for "html to do list"

1

how to make a to-do list in html

<!DOCTYPE html>
<html>
 <head>
 <title>To-Do List App</title>
 <script>
  function addItem() {
   var newItem = document.createElement("div");
   newItem.innerHTML = document.getElementById("box").value;
   newItem.onclick = removeItem;
   document.getElementById("list").appendChild(newItem);
   saveList();
  }
  function removeItem() {
   document.getElementById("list").removeChild(this);
   saveList();
 </script>
</head>
<body>
 <div class="header">
 </div>
 <div class="app">
  <input type="text" id="box" value="Type here to add task"/>
  <br/>
  <input type="button" value="Add item" onclick="addItem();"/>
  <br/>
   <div id="list"></div>
 </div>
</body>
</html>
Posted by: Guest on August-08-2021

Browse Popular Code Answers by Language