-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
48 lines (43 loc) · 1.58 KB
/
index.html
File metadata and controls
48 lines (43 loc) · 1.58 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
<!DOCTYPE html>
<html lang="en">
<head>
<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>Random name picker</title>
<link rel="stylesheet" href="./style.css">
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
</head>
<body>
<div class="center h100">
<div class="container-sm">
<h1 id="title">Random name picker</h1>
<input type="text" id="names" class="box" placeholder="Enter names here">
<ul id="namelist"></ul>
<button id="run" class="w100">Pick a random name</button>
</div>
</div>
<div id="winner" class="center hidden">
<div class="wrapper">
<h2>Congratulations</h2>
<h3 id="name">%Winner%</h3>
<button id="removename">Remove name from list</button>
<button id="keepname">keep name in list</button>
</div>
</div>
<script>
var names = [];
var winner = "";
function removename($name) {
names = names.filter(function(value, index, arr) {
return value != $name;
});
document.getElementById("namelist").innerHTML = "";
names.forEach(function(item) {
document.getElementById("namelist").innerHTML += `<li onclick="removename('${item}');">${item}</li>`;
});
}
</script>
<script type="module" src="./main.js"></script>
</body>
</html>