-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
25 lines (23 loc) · 768 Bytes
/
Copy pathscript.js
File metadata and controls
25 lines (23 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
document.querySelector("#push").onclick = function () {
if (document.querySelector("#newtask input").value.length == 0) {
alert("Please Enter a Task");
} else {
document.querySelector("#tasks").innerHTML += `
<div class="task">
<span id="taskname">
${document.querySelector("#newtask input").value}
</span>
<button class="delete">
<i class="fa-solid fa-trash-can"></i>
</button>
</div>`;
document.querySelector("#newtask input").value = "";
var current_tasks = document.querySelectorAll(".delete");
console.log(typeof current_tasks);
for (var i = 0; i < current_tasks.length; i++) {
current_tasks[i].onclick = function () {
this.parentNode.remove();
};
}
}
};