-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
82 lines (66 loc) · 2.73 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
<!DOCTYPE html>
<html lang="en">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js" type="text/javascript"></script>
<link href="https://fonts.googleapis.com/css2?family=Montserrat:wght@500&display=swap" rel="stylesheet">
<link href="styles.css" rel="stylesheet">
<title>Trivia!</title>
<script>
$(document).ready(function() {
$("button#gw").click( function () {
$(this).css("background-color", "red");
$("#feedback1").html("Incorrect");
});
$("button#ah").click( function () {
$(this).css("background-color", "green");
$("#feedback1").html("Correct!");
});
$("button#jg").click( function () {
$(this).css("background-color", "red");
$("#feedback1").html("Incorrect");
});
$("button#gc").click( function () {
$(this).css("background-color", "red");
$("#feedback1").html("Incorrect");
});
$("button#check").click( function () {
$(this).text("Submitted!");
let answer = $('#q2').val();
if (answer === "Thomas Jefferson") {
$("#feedback2").html("Correct!");
$("#q2").css("background-color", "green");
}
else {
$("#feedback2").html("Incorrect. <br> The answer is Thomas Jefferson.");
$("#q2").css("background-color", "red");
}
});
});
</script>
</head>
<body>
<div class="jumbotron">
<h1>Trivia!</h1>
</div>
<div class="container">
<div class="section1">
<h2>Part 1: Multiple Choice </h2>
<hr>
<h3>Who was NOT a president of the United States?</h3>
<button id="gw">George Washington</button>
<button id="ah">Alexander Hamilton</button>
<button id="jg">James Garfield</button>
<button id="gc">Grover Cleveland</button>
<p id="feedback1"></p>
</div>
<div class="section2">
<h2>Part 2: Free Response</h2>
<hr>
<h3>Who was the third president of the United States?</h3>
<input id="q2" type="text" placeholder="Answer"></input>
<button id="check">Check</button>
<p id="feedback2"></p>
</div>
</div>
</body>
</html>