-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.js
28 lines (22 loc) · 936 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
document.querySelector("#signupform").addEventListener("submit", signup);
function signup(e) {
e.preventDefault();
console.log("signup");
var fname = document.getElementById("fname").value;
localStorage.setItem("userName", JSON.stringify(fname));
var lname = document.getElementById("lname").value;
var email = document.getElementById("email").value;
var password = document.getElementById("password").value;
var confpass = document.getElementById("confpassword").value;
var mob = document.getElementById("mobnumber").value;
if (password != confpass) {
alert("Password & Confirm Password does not match");
return;
}
var data = { fname, lname, email, password, mob };
var old_data = JSON.parse(localStorage.getItem("signupData")) || [];
old_data.push(data);
localStorage.setItem("signupData", JSON.stringify(old_data));
alert("Signup Successfull");
window.location.href="./signin.html"
}