-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathform.html
More file actions
37 lines (34 loc) · 1.02 KB
/
form.html
File metadata and controls
37 lines (34 loc) · 1.02 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
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="form.css">
<div class="topnav">
<a class = "logo" href="#lunchhub">Lunch Hub</a>
<a class="active" href="/index.html">Home</a>
<a href="./form.html">Vote</a>
<a href="./lunch.html">Lunch</a>
</div>
<title>Vote on Next Week's lunch!</title>
</head>
<body>
<h1>What lunch do you want</h1>
<form>
<input type="radio" name="lunch" value="Salmon">Salmon<br>
<input type="radio" name="lunch" value="Burger">Burger<br>
<input type="radio" name="lunch" value="Pizza">Pizza<br>
<button type="submit">Submit</button>
</form>
<div id="form-submitted-message" style="display:none;">
<p>Form submitted successfully!</p>
</div>
<script>
const form = document.querySelector('form');
const message = document.querySelector('#form-submitted-message');
form.addEventListener('submit', (event) => {
event.preventDefault();
message.style.display = 'block';
form.reset();
});
</script>
</body>
</html>