forked from ammarlodhi255/travel-and-tour-agency-website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.js
33 lines (29 loc) · 921 Bytes
/
signup.js
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
let signupBtn = document.querySelector("button.signup");
signupBtn.onclick = () => {
let name = document.querySelector("#name");
let email = document.querySelector("#email");
let phone = document.querySelector("#phone");
let password = document.querySelector("#password");
let new_user = {
Picture: "",
Name: name.value,
Email: email.value,
Phone: phone.value,
Password: password.value,
};
let users = JSON.parse(localStorage.getItem("Users"));
users.push(new_user);
localStorage.setItem("Users", JSON.stringify(users));
let label = document.createElement("label");
label.innerText = "User successfully added";
label.style.color = "green";
label.style.margin = "5em";
signupBtn.parentElement.appendChild(label);
name.value = "";
email.value = "";
phone.value = "";
password.value = "";
};
function openLoginForm() {
document.location.href = "./login.html";
}