-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
24 lines (18 loc) · 841 Bytes
/
script.js
File metadata and controls
24 lines (18 loc) · 841 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Challenge 1: Alert value of password input when submitting
function showPassword(event) {
event.preventDefault();
let passwordInput = document.querySelector("#password-input");
alert(`Your password is ${passwordInput.value}`);
}
let passwordForm = document.querySelector("#password-form");
passwordForm.addEventListener("submit", showPassword);
// Challenge 2: Alert value of username and email inputs when submitting
function showLoginFormValues(event) {
event.preventDefault();
let usernameInput = document.querySelector("#username-input");
let emailInput = document.querySelector("#email-input");
alert(`Your username is ${usernameInput.value}`);
alert(`Your email is ${emailInput.value}`);
}
let loginForm = document.querySelector("#login-form");
loginForm.addEventListener("submit", showLoginFormValues);