-
Notifications
You must be signed in to change notification settings - Fork 0
/
signup.js
38 lines (31 loc) · 989 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
34
35
36
37
38
document.querySelector("#one").addEventListener("submit",signup);
let userdata=JSON.parse(localStorage.getItem("userdetail"))||[];
let Userarr =[]
function signup(event){
event.preventdefault()
let username = document.querySelector("#name").value;
let useremail = document.querySelector("#email").value;
let usernumber = document.querySelector("#num").value;
let userpass = document.querySelector("#pass").value;
let confirm_pas = document.querySelector("#con").value;
let obj = {
username,
useremail,
usernumber,
userpass,
confirm_pas
}
if ( userpass==confirm_pas){
if(username!="" && useremail!="" && usernumber!="" && userpass!="" && confirm_pas!=""){
userdata.push(obj)
Userarr.push(obj)
localStorage.setItem("userdetail",JSON.stringify(userdata))
localStorage.setItem("dell",JSON.stringify(Userarr))
}else{
alert("Please fill all details")
}
}else{
alert("Password is incorrect")
}
}
signup()