-
Notifications
You must be signed in to change notification settings - Fork 425
/
index.html
40 lines (40 loc) · 1.15 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
<!DOCTYPE html>
<html>
<head>
<title>Sample Login Form</title>
<style>
* {
font-family: sans-serif;
}
input {
display: block;
margin-bottom: 16px;
width: 200px;
}
button {
padding: 8px 16px;
font-size: large;
}
</style>
</head>
<body>
<form name="login-form">
<label for="email">Email</label>
<input type="email" name="email" id="email" data-test="email-field" required />
<label for="password">Password</label>
<input type="password" name="password" id="password" data-test="password-field" required />
<button type="submit" data-test="login-button">Login</button>
</form>
<script>
document.querySelector('button[type="submit"]').addEventListener('click', function(event) {
event.preventDefault()
const emailField = document.getElementById('email')
const passwordField = document.getElementById('password')
if (!emailField.value || !passwordField.value) {
return
}
document.body.innerHTML = "<h1>You\'re now logged in!</h1>"
}, false)
</script>
</body>
</html>