forked from AhmadAlYaaqba/To-Do-List
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
95 lines (68 loc) · 2.95 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
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
<!DOCTYPE html>
<html>
<head>
<title>To-Do-List</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="style.css">
<script defer src="https://use.fontawesome.com/releases/v5.0.7/js/all.js"></script>
</head>
<body>
<div class = "row">
<div class = "leftColumn">
<div class="card">
<button class="btn buttonStyle" onclick="dropForTask()"><i class="fas fa-tasks"></i> Add Task</button>
<div id="myDropdown" class="dropdown-content">
<input type="text" id="inputTask">
<button id="addTask" class="btn-block buttonStyle"><i class="fa fa-plus-circle"></i> add</button>
</div>
</div>
<div id="del">
<button id="deleteAll" class="btn-danger btn-block buttonStyle"><i class="far fa-trash-alt"></i>Delete All Tasks</button>
</div>
</div>
<div class = "centerColumn">
<div class="cardCenter" id="listToDo">
<h2>To-Do-List</h2>
<div>
<ol id="list">
</ol>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script type="text/javascript">
$(document).ready(function(){
var arr=["#6ec0e7","#53e3e0","#b9c3c7","#85c9ac","#42a2ea","#b9c3c7","#0c77c7"]
$("#addTask").on('click',function(){
var $display = $('<li></li>')
var inputText = $('#inputTask').val();
if(inputText === ""){
alert("Please Enter text")
}
else {
var rand=Math.floor(Math.random()*arr.length)
$('.cardCenter').css('background-color',arr[rand])
$($display).css('background-color',arr[rand])
$display.text(inputText) ;
$display.appendTo('#list')
}
$( "#deleteAll" ).click(function() {
$($display).hide()
setTimeout(function(){
window.location.reload();
}, 1000 );
})
$($display).on('dblclick',function(){
$($display).hide()
})
})
})
function dropForTask() {
document.getElementById("myDropdown").classList.toggle("show");
}
</script>
</body>
</html>