MCPcopy Index your code
hub / github.com/codemistic/Web-Development / create

Function create

todo-list/script.js:27–71  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

25var data;
26// Functions
27function create(e) {
28
29 e.preventDefault();
30 data = todoInput.value;
31 const time = todoInputTime.value; // Time
32
33 console.log(data);
34 console.log(time);
35
36 data = data.trim();
37
38 if (data != "") {
39 var newDiv = document.createElement("div");
40 newDiv.classList.add("todo");
41
42 var timeBtn = document.createElement("li");
43 timeBtn.classList.add("todo-item");
44 timeBtn.innerText=time;
45 newDiv.appendChild(timeBtn);
46
47 var newLi = document.createElement("li");
48 newLi.classList.add("todo-item");
49 newLi.innerText = data ;
50 newDiv.appendChild(newLi);
51
52
53
54
55 var cmpltBtn = document.createElement("button");
56 cmpltBtn.classList.add("cmpltBtn");
57 cmpltBtn.innerHTML = '<i class="fa fa-check " aria-hidden="true"></i>';
58 newDiv.appendChild(cmpltBtn);
59
60 var deleteBtn = document.createElement("button");
61 deleteBtn.classList.add("deleteBtn");
62 deleteBtn.innerHTML = '<i class="fa fa-trash" aria-hidden="true"></i>';
63 newDiv.appendChild(deleteBtn);
64
65 todoList.appendChild(newDiv);
66 todoInput.value = "";
67 todoInputTime.value="";
68 } else {
69 alert("Box can not be blank");
70 }
71}
72
73function performAction(e) {
74 var item = e.target;

Callers 2

App.jsFile · 0.50
generateHtmlFunction · 0.50

Calls 1

logMethod · 0.45

Tested by

no test coverage detected