MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / newToDoItem

Function newToDoItem

assets/js/todo-app.js:36–61  ·  view source on GitHub ↗
(itemtext, index, completed)

Source from the content-addressed store, hash-verified

34
35//Display new todo
36function newToDoItem(itemtext, index, completed) {
37 let newLiTag = "";
38 if (completed) {
39 newLiTag = `<li id=${index} class="item">
40 <label class="todo-list__label">
41 <input type="checkbox" class="checkbox completed" onclick="toggleToDoItemState(this)"/>
42 <i class="check"></i>
43 <span class="todo-text">${itemtext}</span>
44 <span class="trash" onclick="deleteTask(${index})"><i class="fas fa-trash"></i></span>
45 </label>
46 </li>`;
47 } else {
48 newLiTag = `<li id=${index} class="item">
49 <label class="todo-list__label">
50 <input type="checkbox" class="checkbox" onclick="toggleToDoItemState(this)"/>
51 <i class="check"></i>
52 <span class="todo-text">${itemtext}</span>
53 <span class="trash" onclick="deleteTask(${index})"><i class="fas fa-trash"></i></span>
54 </label>
55 </li>`;
56 }
57
58 todoList.innerHTML += newLiTag;
59
60 saveToDoItems();
61}
62
63// Add todo
64addBtn.onclick = () => {

Callers 2

todo-app.jsFile · 0.85
loadListFunction · 0.85

Calls 1

saveToDoItemsFunction · 0.85

Tested by

no test coverage detected