-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
131 lines (128 loc) · 4.43 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Sign Up</title>
<link rel="stylesheet" href="./styles.css" />
</head>
<body class="flex">
<div id="banner" class="flex flex-col">
<div class="flex">
<img src="./assets/images/odin-lined.png" alt="odin project logo" />
<p>ODIN</p>
</div>
<p>
Photo by
<a href="https://unsplash.com/@thirdcultureken">Kentaro Toma</a>
on
<a
href="https://unsplash.com/photos/silhouette-of-trees-and-mountains-during-daytime-5SrZfhkNdBo"
>
Unsplash
</a>
</p>
</div>
<main class="flex flex-col">
<p>
This is not a real online service! You know you need something like this
in your life to help you realize your deepest dreams. Sign up
<span>now</span> to get started.
</p>
<p>You <span>know</span> you want to.</p>
<form action="#" method="post" class="flex flex-col">
<p>Let's do this!</p>
<div class="form-row flex">
<div class="flex flex-col">
<label for="firstName">FIRST NAME <span>*Required</span></label>
<input type="text" id="firstName" placeholder="John" required />
</div>
<div class="flex flex-col">
<label for="lastName">LAST NAME</label>
<input type="text" id="lastName" placeholder="Doe" />
</div>
</div>
<div class="form-row flex">
<div class="flex flex-col">
<label for="email">EMAIL <span>*Required</span></label>
<input
type="email"
name="email"
id="email"
placeholder="youremail@example.com"
required
/>
</div>
<div class="flex flex-col">
<label for="phone">PHONE NUMBER</label>
<input
type="tel"
name="phone"
id="phone"
pattern="\+[0-9]{1,3}\s?[0-9]{3,14}"
placeholder="+91 1234567890"
/>
</div>
</div>
<div class="form-row flex">
<div class="flex flex-col">
<label for="password">PASSWORD <span>*Required</span></label>
<input
type="password"
name="password"
id="password"
pattern=".{8,16}"
placeholder="at least 8 characters"
required
/>
<span id="password-alert">*Passwords do not match!</span>
</div>
<div class="flex flex-col">
<label for="confirmPassword">
CONFIRM PASSWORD <span>*Required</span></label
>
<input
type="password"
name="confirmPassword"
id="confirmPassword"
pattern=".{8,16}"
required
/>
</div>
</div>
<button type="submit">Create Account</button>
</form>
<p>
Already have an account?
<a href="#" target="_blank" rel="noopener noreferrer">Log in</a>
</p>
</main>
<script defer>
const password = document.querySelector("#password");
const confirmPassword = document.querySelector("#confirmPassword");
const passwordAlert = document.querySelector("#password-alert");
password.addEventListener("input", checkPassword);
confirmPassword.addEventListener("input", checkPassword);
document.querySelector("button").addEventListener("click", (event) => {
if (passwordAlert.style.opacity == "100") {
event.preventDefault();
}
});
function checkPassword() {
if (password.value !== confirmPassword.value) {
passwordAlert.style.opacity = "100";
password.style.border = "1px solid red";
password.style.backgroundColor = "rgba(255, 0, 0, 0.089)";
confirmPassword.style.border = "1px solid red";
confirmPassword.style.backgroundColor = "rgba(255, 0, 0, 0.089)";
} else {
passwordAlert.style.opacity = "0";
password.style.border = "1px solid rgb(8, 114, 235)";
password.style.backgroundColor = "";
confirmPassword.style.border = "1px solid rgb(8, 114, 235)";
confirmPassword.style.backgroundColor = "";
}
}
</script>
</body>
</html>