-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2page.html
More file actions
133 lines (104 loc) · 2.94 KB
/
Copy path2page.html
File metadata and controls
133 lines (104 loc) · 2.94 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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Book Consultation - Curomind</title>
<style>
/* Add your CSS here */
body {
display: flex;
justify-content: center;
height: 100vh;
align-items: center;
}
.form {
background-color: lightblue;
display: flex;
justify-content: center;
align-items: center;
height: 400px;
width: 300px;
}
.i {
margin-top: 60px;
margin-bottom: 60px;
margin-right: 30px;
margin-left: 30px;
padding-left: 47px;
}
button {
/* changed this */
width: auto;
padding-left: 0px;
padding-right: 0px;
margin-top: 10px;
background: #2563eb;
color: white;
border: none;
border-radius: 6px;
font-size: 16px;
cursor: pointer;
transition: 0.3s;
margin-right: 70px;
margin-left: 0px;
box-sizing: border-box;
}
}
it is not becooming symetricall what i do neither width is changing
}
</style>
</head>
<body>
<div class="form">
<div class="i">
<span style="font-size:30px">Request a Consultation</span><br>
<form>
<input type="text" placeholder=" Name" style="margin-bottom:10px;margin-top:10px"><br>
<input type="email" placeholder="email" style="margin-bottom:10px"><br>
<input type="number" placeholder="age" style="margin-bottom:10px"><br>
<input type="text" placeholder="Gender">
<button type="submit"
style="width:100%; padding:10px; background:#2563eb; color:white; border:none; border-radius:5px; cursor:pointer;">
Book Appointment
</button>
</form>
</div>
</div>
<script>
// Select the form and all inputs
const form = document.querySelector("form");
const inputs = document.querySelectorAll("input");
// Add submit event listener
form.addEventListener("submit", function (e) {
e.preventDefault(); // Prevent page refresh
const name = inputs[0].value.trim();
const email = inputs[1].value.trim();
const age = inputs[2].value.trim();
const gender = inputs[3].value.trim();
// Basic validation
if (name === "" || email === "" || age === "" || gender === "") {
alert("Please fill out all fields.");
return;
}
if (age <= 0) {
alert("Please enter a valid age.");
return;
}
// Success Message
alert("✅ Consultation Request Submitted Successfully!");
// Clear form after submission
form.reset();
});
// Allow Enter key submission
inputs.forEach(input => {
input.addEventListener("keypress", function (e) {
if (e.key === "Enter") {
form.dispatchEvent(new Event("submit"));
}
});
});
</script>
<!-- Your content will go here -->
</body>
</html>