Skip to content

Commit d1322be

Browse files
authored
Add files via upload
1 parent 3cacbf2 commit d1322be

3 files changed

Lines changed: 128 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Mark List as Completed</title>
7+
<link rel="stylesheet" href="style.css">
8+
</head>
9+
<body>
10+
<div class="container">
11+
<h1>Mark List as Completed</h1>
12+
<div class="input-section">
13+
<input type="text" id="taskInput" placeholder="Enter your task...">
14+
<button id="click">Add Task</button>
15+
</div>
16+
<ul id="taskList"></ul>
17+
</div>
18+
19+
<script src="script.js"></script>
20+
</body>
21+
</html>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
const input = document.getElementById("taskInput");
2+
const button = document.getElementById("click");
3+
const list = document.getElementById("taskList");
4+
5+
button.addEventListener("click", () => {
6+
const inputText = input.value.trim();
7+
8+
if (inputText !== "") {
9+
// create list element
10+
const li = document.createElement("li");
11+
li.textContent = inputText;
12+
13+
// create delete button
14+
const deleteBtn = document.createElement("button");
15+
deleteBtn.textContent = "Delete";
16+
17+
deleteBtn.addEventListener("click", () => {
18+
li.remove();
19+
});
20+
21+
// add delete button
22+
li.appendChild(deleteBtn);
23+
24+
// add list item
25+
list.appendChild(li);
26+
27+
// add complete class
28+
li.addEventListener("click", () => {
29+
li.classList.toggle("completed");
30+
});
31+
}
32+
else {
33+
alert ("Enter some task!");
34+
}
35+
36+
input.value = "";
37+
38+
});
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
body {
2+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
3+
padding: 100px;
4+
text-align: center;
5+
background: linear-gradient(to right, cornflowerblue, crimson);
6+
}
7+
8+
.container {
9+
padding: 30px;
10+
background-color: white;
11+
border: none;
12+
border-radius: 50px;
13+
width: 30%;
14+
margin: auto;
15+
}
16+
17+
.input-section {
18+
display: flex;
19+
align-items: center;
20+
justify-content: center;
21+
gap: 10px;
22+
}
23+
24+
input {
25+
padding: 12px;
26+
border: 3px solid grey;
27+
border-radius: 10px;
28+
font-size: 15px;
29+
width: 60%;
30+
}
31+
32+
button {
33+
background-color: chartreuse;
34+
border: 3px solid chartreuse;
35+
border-radius: 10px;
36+
padding: 10px 20px;
37+
font-size: 15px;
38+
font-weight: 800;
39+
cursor: pointer;
40+
}
41+
42+
li {
43+
list-style: none;
44+
margin-bottom: 10px;
45+
background-color: rgb(217, 215, 215);
46+
padding: 8px 12px;
47+
border: none;
48+
border-radius: 10px;
49+
text-align: left;
50+
width: 85%;
51+
display: flex;
52+
align-items: center;
53+
justify-content: space-between;
54+
}
55+
56+
li:hover {
57+
background-color: darkgrey;
58+
}
59+
60+
li button {
61+
padding: 8px;
62+
background-color: cornflowerblue;
63+
border: none;
64+
}
65+
66+
li.completed {
67+
text-decoration: line-through;
68+
background-color: rgb(255, 255, 255);
69+
}

0 commit comments

Comments
 (0)