-
Notifications
You must be signed in to change notification settings - Fork 566
/
todo_list.html
179 lines (153 loc) Β· 6.19 KB
/
todo_list.html
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>ToDo List</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Josefin+Sans:wght@400;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<title>ToDo List</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.2/animate.min.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css" />
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Lora|Montserrat&display=swap" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
<link rel="icon" href="resources/images/ZTM_logo.png" />
<link rel="stylesheet" href="resources/style/style.css" />
<!-- Dark Mode -->
<link rel="stylesheet" type="text/css" href="resources/style/themeToggle.css" />
<script src="resources/scripts/themeToggle.js" defer></script>
<!-- /Dark Mode -->
<style>
body {
text-align: center;
/* font-family: 'Josefin Sans', sans-serif; */
}
h1 {
margin-top: 10rem;
margin-bottom: 30px;
font-size: 5em;
}
.navbar{
background-color: #009999;
position: fixed;
}
li {
list-style: none;
}
.newBtn {
margin: 20px;
background-color: #e15563;
}
div button{
margin-bottom: 9px;
border-radius: 10px;
}
#product{
font-size: 1.5rem;
margin: 10px;
}
.done {
text-decoration: line-through;
}
#reload {
padding: 10px;
font-size: medium;
}
div button:hover{
color: white;
background-color: black;
border-radius: 10px;
}
</style>
</head>
<body>
<!-- navbar -->
<nav class="navbar navbar-expand-lg navbar-dark fixed-top">
<a class="navbar-brand" href="index.html"><img src="resources/images/ZTM_logo.png" alt="logo"></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link nav-font" href="index.html">Home</a>
</li>
<li class="nav-item">
<a class="nav-link nav-font" href="about.html">About</a>
</li>
<li class="nav-item">
<a class="nav-link nav-font" href="instructor.html">Instructor</a>
</li>
<li class="nav-item">
<a class="nav-link nav-font" href="register.html">Sign Up</a>
</li>
<li class="nav-item">
<a class="nav-link nav-font" href="contributersProfile.html">Contributors</a>
</li>
<li class="nav-item active-link">
<a class="nav-link nav-font" href="todo_list.html">Student Projects</a>
</li>
<li class="nav-item">
<a class="nav-link nav-font" href="contact-us.html">Contact Us</a>
</li>
</ul>
</div>
<div class="theme-toggle-container">
<span class="theme-toggle-text">Light Mode</span>
<label class="theme-toggle">
<input id="theme-toggle-switch" type="checkbox">
<span class="slider round"></span>
</label>
</div>
<a id="headerText" class="nav-link ml-md-auto nav-font" href="beyondztm.html">Beyond Zero to Mastery <i
class="fas fa-arrow-right"></i></a>
</nav>
<!-- end nav bar -->
<div class="first-div">
<h1>To Do List</h1>
<form action="/nowhere">
<input type="text" id="product" name="product" placeholder="Enter Item">
<button class="btn btn-primary" id="btn-submit">Submit</button>
</form>
<br><br>
<h3>List :</h3>
<ul id="list"></ul>
<button class="btn btn-dark"id="reload" onclick="location.reload()">Refresh</button>
</div>
<!-- ------------------------------------------------------------- -->
<!-- ------------------------------------------------------------- -->
<script>
let form = document.querySelector('form');
let product = document.getElementById("product");
let buttonSubmit = document.getElementById("btn-submit")
product.addEventListener('keyup', (event) => {
let value = event.target.value;
value !== '' ? buttonSubmit.disabled = false : buttonSubmit.disabled = true
});
form.addEventListener("submit", (event) => {
let li = document.createElement("li");
let btn = document.createElement("button");
let span = document.createElement("span");
btn.innerText = "Delete Item";
btn.classList.add("newBtn");
li.append(product.value, btn);
li.addEventListener('click', () => {
li.classList.toggle('done');
});
span.append(li);
let ul = document.querySelector("#list");
ul.append(span);
btn.addEventListener("click", () => {
span.remove();
})
product.value = "";
buttonSubmit.disabled = true;
event.preventDefault();
});
</script>
</body>
</html>