-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
82 lines (68 loc) · 2.64 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>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PTO Sponsor</title>
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
</head>
<body>
<div class="container mt-5">
<h1>PTO Sponsors</h1>
<!-- Form for adding new rows -->
<form id="dataForm">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" id="name" required>
</div>
<div class="form-group">
<label for="business">Business:</label>
<input type="text" class="form-control" id="business" required>
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email" required>
</div>
<button type="submit" class="btn btn-primary">Add Row</button>
</form>
<!-- Table to display data -->
<table class="table mt-4">
<thead>
<tr>
<th>Name</th>
<th>Business</th>
<th>Email</th>
</tr>
</thead>
<tbody id="dataTable">
<!-- Table body will be populated dynamically -->
</tbody>
</table>
</div>
<!-- Bootstrap JS -->
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
<script>
// adding rows to the table
document.getElementById('dataForm').addEventListener('submit', function (event) {
event.preventDefault(); // Prevent default form submission
// Get input values
var name = document.getElementById('name').value;
var business = document.getElementById('business').value;
var email = document.getElementById('email').value;
// Create a new row
var newRow = document.createElement('tr');
newRow.innerHTML = `
<td>${name}</td>
<td>${business}</td>
<td>${email}</td> `;
// Append the new row to the table body
document.getElementById('dataTable').appendChild(newRow);
// Clear the form inputs
document.getElementById('name').value = '';
document.getElementById('business').value = '';
document.getElementById('email').value = '';
});
</script>
</body>
</html>