-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
130 lines (108 loc) · 2.64 KB
/
index.html
File metadata and controls
130 lines (108 loc) · 2.64 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>TodoList</title>
<style>
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 18px;
}
.container {
margin: 20px auto;
width: 500px;
border: 1px solid #e6e6e6;
border-radius: 3px;
}
h1 {
text-align: center;
}
form {
padding: 0 0 20px;
}
input#new-todo {
display: block;
width: 478px;
border-radius: 3px;
border: 1px solid #e6e6e6;
padding: 10px;
font-size: 18px;
}
ul#todolist {
list-style: none;
margin: 0;
padding: 0;
}
ul#todolist li {
padding: 5px;
border: 1px solid #e6e6e6;
border-radius: 3px;
}
ul#todolist li:hover {
background-color: #e6e6e6;
}
ul#todolist .todo.completed label {
text-decoration: line-through;
color: #999;
}
.footer {
margin-top: 10px;
background: #323232;
color: #e6e6e6;
padding: 5px;
border-bottom-left-radius: 3px;
border-bottom-right-radius: 3px;
}
.footer a:link,
.footer a:hover,
.footer a:visited {
color: #e6e6e6;
text-decoration: none;
}
.footer a:hover {
text-decoration: underline;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
</head>
<body>
<div class="container">
<h1>TodoList</h1>
<form>
<input type="text" id="new-todo" placeholder="What needs to be done?">
</form>
<ul id="todolist">
<li class="todo">
<input id="todo-1" type="checkbox">
<label for="todo-1">Sweep the floor</label>
</li>
<li class="todo completed">
<input id="todo-2" type="checkbox" checked="checked">
<label for="todo-2">Dust the vases</label>
</li>
</ul>
<div class="footer">
Todo: <span id="todo-count">1</span> • Done: <span id="completed-count">0</span> • Total: <span id="total-count">1</span>
</div>
</div>
<script>
$("#total-count").html($(".todo").length);
$(document).ready(function() {
$("input[type=checkbox]").bind('change', toggleDone);
updateCounters();
});
function toggleDone() {
var checkbox = this;
$(checkbox).parent().toggleClass("completed");
}
function updateCounters() {
var todoCount = $(".todo").length;
var completedCount = $(".completed").length;
$("#total-count").html(todoCount);
$("#completed-count").html(completedCount);
$("#todo-count").html(todoCount - completedCount);
}
updateCounters();
</script>
</body>
</html>