-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
43 lines (43 loc) · 1.16 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/css/style.css" />
<script
src="https://code.jquery.com/jquery-3.5.1.js"
integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc="
crossorigin="anonymous"
></script>
<title>To-Do App | Jquery</title>
</head>
<body>
<div id="container">
<h3>Todo List</h3>
<input type="text" placeholder="Type Todo" />
<ul>
<li>Test ToDo <span>X</span></li>
</ul>
</div>
<script>
$("input").keypress(function (e) {
if (e.which === 13) {
const mytext = $(this).val();
$(this).val("");
$("ul").append("<li>" + mytext + "<span>X</span></li>");
}
});
$("ul").on("click", "span", function (e) {
$(this)
.parent()
.fadeOut(200, function () {
$(this).remove();
});
e.stopPropagation();
});
$("ul").on("click", "li", function () {
$(this).toggleClass("done");
});
</script>
</body>
</html>