-
Notifications
You must be signed in to change notification settings - Fork 1
/
signup.js
76 lines (63 loc) · 1.91 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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import {navbar} from './components/navbar.js'
let nav=document.getElementById('navbar')
nav.innerHTML=navbar();
// login/signup popup
document.getElementById('login-sign').addEventListener('click',function(){
document.querySelector('.popup').style.display="flex";
})
document.querySelector('.close1').addEventListener('click',function(){
document.querySelector('.popup').style.display="none";
})
//for hiding password
const forms=document.querySelector('.popup')
const pwShowHide=document.querySelectorAll('.eye-icon')
const links=document.querySelectorAll('.link')
// console.log(forms,pwShowHide,links)
pwShowHide.forEach(eyeIcon=>{
eyeIcon.addEventListener('click',()=>{
let pwFields=eyeIcon.parentElement.parentElement.querySelectorAll('#password')
pwFields.forEach(password=>{
if(password.type=="password"){
password.type="text";
eyeIcon.classList.replace("bx-hide","bx-show")
return;
}
password.type="password";
eyeIcon.classList.replace("bx-show","bx-hide")
})
})
})
links.forEach(link=>{
link.addEventListener('click',e=>{
e.preventDefault();
forms.classList.toggle('show-signup')
})
})
// redirecting to indexpage for login
let sub=document.querySelector('.link')
sub.onclick=()=>{
window.location.href="./index.html"
}
// storing signin data to localstorage
JSON.parse(localStorage.getItem('data'))||[]
let sign=document.getElementById('continue')
sign.addEventListener('click',function(){
regi(event)
})
let regi=(e)=>{
// e.preventDefault()
var email=document.getElementById('email').value;
var password=document.getElementById('password').value;
if(email==""||password=="")
{
e.preventDefault()
alert('Fill all the Details')
}
else{
let obj={
email,password
}
localStorage.setItem('data',JSON.stringify(obj))
window.location.href="./login.html"
}
}