forked from FirmanKurniawan/HTML-Projects
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTo_Do_List.html
109 lines (103 loc) · 2.42 KB
/
To_Do_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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.1.1/css/all.min.css">
<style media="screen">
*{
margin: 0; padding: 0;
box-sizing: border-box;
letter-spacing: 1px;
font-family: Verdana, Geneva, Tahoma, sans-serif;
text-transform: capitalize;
}
body{
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(45deg, grey 50%, yellow 50%);
}
.container{
height: 450px;
width: 330px;
background: #fff;
border-radius: 5px;
box-shadow: 0 50px 10px rgba(0, 0, 0, 0.5);
padding: 10px;
overflow-y: auto;
}
#input{
height: 50px;
width: 100%;
outline: none;
border: none;
border-radius: 5px;
background: #666;
color: #fff;
padding: 0 10px;
margin: 15px 0;
}
#input::placeholder{
color: #bbb;
}
ul li{
background: #eee;
color: #333;
height: 40px;
border-radius: 50px;
margin: 10px 0;
padding: 10px;
position: relative;
}
ul .fa-check, .fa-trash{
position: absolute;
cursor: pointer;
}
ul .fa-check{
right: 40px;
color: green;
}
ul .fa-trash{
right: 15px;
color: #ff0033;
}
ul .checked{
background: lightgreen;
text-decoration: line-through;
transition: .2s;
}
@media only screen and (max-width: 600px) {
.container {
width: 100vh;
height: 80vh;
}
}
</style>
<script src="https://code.jquery.com/jquery-3.6.0.js" charset="utf-8"></script>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>To Do List</title>
</head>
<body>
<div class="container">
<input type="text" id="input" placeholder="Ketik disini lalu klik enter">
<ul></ul>
</div>
<script type="text/javascript">
$(document).ready(function(){
$('#input').change(function(){
var input = $(this).val();
$('ul').append('<li>' + input + '<i class="fas fa-check"></i> <i class="fas fa-trash"></i> </li>');
$(this).val('');
});
$('ul').on('click', '.fa-trash',function(){
$(this).parent('li').fadeOut(200);
});
$('ul').on('click', '.fa-check',function(){
$(this).parent('li').toggleClass('checked');
});
});
</script>
</body>
</html>