-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_details.html
100 lines (91 loc) · 3.55 KB
/
user_details.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html>
<html>
<head>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="styles/shared/general.css">
<link rel="stylesheet" href="styles/shared/amazon-header.css">
<link rel="stylesheet" href="styles/pages/amazon.css">
<title>User Details</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles/shared/general.css">
<link rel="stylesheet" href="styles/pages/user_details.css">
</head>
<body>
<div class="amazon-header">
<div class="amazon-header-left-section">
<a href="amazon.html" class="header-link">
<img class="amazon-logo"
src="images/amazon-logo-white.png">
<img class="amazon-mobile-logo"
src="images/amazon-mobile-logo-white.png">
</a>
</div>
<div class="amazon-header-right-section">
<a class="orders-link header-link" href="orders.html">
<span class="returns-orders-text">Returns & Orders</span>
</a>
<a class="cart-link header-link" href="checkout.html">
<img class="cart-icon" src="images/icons/cart-icon.png">
<div class="cart-quantity js-cart-quantity">0</div>
<div class="cart-text">Cart</div>
</a>
</div>
</div>
<div class="main">
<div class="page-title">Enter Your Details</div>
<form id="details-form">
<input type="text" id="address" placeholder="Address" required>
<input type="text" id="country" placeholder="Country" required>
<input type="text" id="city" placeholder="City" required>
<input type="text" id="zipcode" placeholder="Zip Code" required>
<button class="proceed-button" id="proceed-button">Next</button>
</form>
</div>
<script>
const form = document.getElementById("details-form");
const addressInput = document.getElementById("address");
const countryInput = document.getElementById("country");
const cityInput = document.getElementById("city");
const zipcodeInput = document.getElementById("zipcode");
const proceedButton = document.getElementById("proceed-button");
addressInput.addEventListener("input", () => {
if (!addressInput.value.trim()) {
addressInput.setCustomValidity("Address is required");
} else {
addressInput.setCustomValidity("");
}
});
countryInput.addEventListener("input", () => {
if (!countryInput.value.trim()) {
countryInput.setCustomValidity("Country is required");
} else {
countryInput.setCustomValidity("");
}
});
cityInput.addEventListener("input", () => {
if (!cityInput.value.trim()) {
cityInput.setCustomValidity("City is required");
} else {
cityInput.setCustomValidity("");
}
});
zipcodeInput.addEventListener("input", () => {
if (!zipcodeInput.value.trim()) {
zipcodeInput.setCustomValidity("Zip Code is required");
} else {
zipcodeInput.setCustomValidity("");
}
});
proceedButton.addEventListener("click", () => {
if (!form.checkValidity()) {
alert("Please fill out all fields");
}
else {
alert("User details entered successfully!");
}
});
</script>
</body>
</html>