-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
78 lines (67 loc) · 2.6 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Registration Form </title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Registration Form</h1>
<div class="container" id="container">
<div class="form-conatainer">
<h3>Submit Details</h3>
<form id="userForm">
<div class="form-1">
<label for="name">Name:</label>
<input type="text" id="name" name="name" required placeholder="Enter your name">
<label for="phoneNumber">Phone Number:</label>
<input type="text" id="phoneNumber" name="phoneNumber" required placeholder="Enter your phone number">
<label for="email">Email:</label>
<input type="email" id="email" name="email" required placeholder="Enter your email address">
<label>Gender:</label>
<input type="radio" id="male" name="gender" value="male" required>
<label for="male">Male</label>
<input type="radio" id="female" name="gender" value="female" required>
<label for="female">Female</label>
</div>
</form>
</div>
<div class="overlay-container">
<div class="overlay">
<div class="overlay-panel overlay-left"></div>
<div class="overlay-panel overlay-right">
<h1>"Start Your Journey Here!"</h1>
<p>Enter your personal details and click here to submit</p>
<button class="btn" id="submitButton" type="submit">Submit</button>
</div>
</div>
</div>
</div>
<footer>
<p>Created with ♥ by
<a target="_blank" href="">Bhumika</a>
</p>
</footer>
<script>
const form = document.getElementById('userForm');
const submitButton = document.getElementById('submitButton');
submitButton.addEventListener('click', function(event) {
event.preventDefault();
const name = document.getElementById('name').value;
const phoneNumber = document.getElementById('phoneNumber').value;
const email = document.getElementById('email').value;
const gender = document.querySelector('input[name="gender"]:checked').value;
const userData = {
name,
phoneNumber,
email,
gender
};
//data stored in session storage
sessionStorage.setItem('userData', JSON.stringify(userData));
alert('Data submitted successfully.');
});
</script>
</body>
</html>