-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsignup.js
26 lines (23 loc) · 1.01 KB
/
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
document.querySelector("button").addEventListener("click", signUp)
var usersData = JSON.parse(localStorage.getItem("userDataBase")) || []
function signUp(){
var first = document.querySelector("#firstName").value;
var last = document.querySelector("#lastName").value;
var email = document.querySelector("#email").value;
var password = document.querySelector("#pass").value;
var checkBox = document.getElementById("checkmark").checked
var checkBox = document.getElementById("checkmark").checked;
if(first == "" || last == "" || email == "" || password =="" || checkBox == false){
alert("Please enter all data")
}else{
var obj = {
firstName:first,
lastName: last,
email:email,
password:password,
}
usersData.push(obj);
window.location.href = "signin_form.html";
}
localStorage.setItem("userDataBase", JSON.stringify(usersData))
}