-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain2.js
48 lines (41 loc) · 1.61 KB
/
main2.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
43
44
45
46
47
48
const taskArea = document.getElementById('taskArea');
const sendbutton = document.getElementsByClassName('sendbutton');
const inputField = document.getElementsByClassName('input-element');
const cross = document.getElementsByClassName('cross');
sendbutton[0].addEventListener('click', submitInputField);
inputField[0].addEventListener('keypress', (e) => {
if (e.key === "Enter") {
submitInputField();
}
});
let counter = 3;
function submitInputField(e) {
counter += 1;
taskArea.innerHTML += `<div class="task1 mt-4" id="task${counter}" draggable="true">
<div class="icons-task1">
<img src="./images/checkmark_icon.png" width="25px" alt="" class="checkmark" onclick="checkmarkFunction('task${counter}')">
<img src="./images/cross_icon.png" width="25px" alt="" class="cross" onclick="removeCrossFunction('task${counter}')">
</div>
<div class="title-task1">
<h2>${inputField[0].value}</h2>
<img src="./images/draganddrop.png" alt="icon">
</div>
</div>`
inputField[0].value = "";
}
function removeCrossFunction(e) {
document.getElementById(e).style.display = "none";
}
function checkmarkFunction(e) {
if (document.getElementById(e).style.textDecoration === "line-through") {
document.getElementById(e).style.textDecoration = "none";
document.getElementById(e).style.opacity = "1";
} else {
document.getElementById(e).style.textDecoration = "line-through";
document.getElementById(e).style.opacity = "0.4";
}
}
function eraseEverything(e) {
taskArea.innerHTML = "";
}
// Droplet password: abraR12345678Abrar