-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplay.js
38 lines (32 loc) · 925 Bytes
/
display.js
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
// display.js
// Retrieve the form data from Local Storage
const formData = JSON.parse(localStorage.getItem('formData'));
// Retrieve the table container element
const tableContainer = document.getElementById('tableContainer');
// Create the table element
const table = document.createElement('table');
table.innerHTML = `
<tr>
<th>Name</th>
<th>Email</th>
<th>Mobile Number</th>
<th>Complaint Type</th>
<th>Society</th>
<th>Complaint/Feedback</th>
</tr>
`;
// Populate the table with form data
formData.forEach((data) => {
const tableRow = document.createElement('tr');
tableRow.innerHTML = `
<td>${data.name}</td>
<td>${data.email}</td>
<td>${data.mobile}</td>
<td>${data.complaintType}</td>
<td>${data.society}</td>
<td>${data.feedback}</td>
`;
table.appendChild(tableRow);
});
// Append the table to the table container
tableContainer.appendChild(table);