-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtoods.js
42 lines (38 loc) · 1.1 KB
/
toods.js
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
document.getElementById("dt").innerHTML= Date().slice(0,16);
const tasks=document.getElementsByClassName("tasks")[0];
const inpt=document.getElementById("inpt");
inpt.addEventListener("keydown",function(event){
if(event.key==="Enter")
add();
})
function add(){
if(inpt.value=="")
{
return;
}
var divp=document.createElement("div");
var divc=document.createElement("div");
divc.setAttribute("class","jj");
var tex=document.createElement("p");
var check=document.createElement("i");
var trash=document.createElement("i");
tex.innerText=inpt.value;
divp.className="item";
check.className="fa-solid fa-square-check";
check.style.color="lightgray";
check.style.resize="59px";
check.addEventListener("click",function(){
check.style.color="black";
})
trash.className="fa-solid fa-trash-can";
trash.style.color="black";
trash.addEventListener("click",function(){
divp.remove();
})
tasks.appendChild(divp);
divp.appendChild(divc);
divp.appendChild(trash);
divc.appendChild(check);
divc.appendChild(tex);
inpt.value='';
}