-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
81 lines (71 loc) · 3.39 KB
/
main.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
77
78
79
80
81
let bnt=document.getElementById('init');
bnt.addEventListener('click',input)
function input(){
let fNome=document.getElementById('first-name').value;
let lNome=document.getElementById("last-name").value;
let email=document.getElementById('email').value;
let password=document.getElementById('password').value;
if(fNome===''){
var labelf=document.getElementById('labelf').innerHTML='First Name cannot be empty';
let imgs=document.getElementById('ic-img')
let div=document.getElementById("img")
imgs.classList.add("vi");
div.classList.add("visivel")
}else{
labelf=document.getElementById('labelf').innerHTML='';
let imgs=document.getElementById('ic-img')
imgs.classList.remove("vi");
let div=document.getElementById("img")
div.classList.remove("visivel")
}
if(lNome===''){
var labell=document.getElementById('labell').innerHTML='Last Name cannot be empty';
let imgs=document.getElementById('ic-imgtwo')
let div=document.getElementById("imgtwo")
imgs.classList.add("vi");
div.classList.add("visivel")
}else{
labelf=document.getElementById('labell').innerHTML='';
let imgs=document.getElementById('ic-imgtwo')
imgs.classList.remove("vi");
let div=document.getElementById("imgtwo")
div.classList.remove("visivel")
}
if(email===''){
var labele=document.getElementById('lab-email').innerHTML='Looks like this is not an email';
let imgs=document.getElementById('ic-img3')
let div=document.getElementById("img3")
imgs.classList.add("vi");
div.classList.add("visivel")
}else{
labele=document.getElementById('lab-email').innerHTML='';
let imgs=document.getElementById('ic-img3')
imgs.classList.remove("vi");
let div=document.getElementById("img3")
div.classList.remove("visivel")
let corr=email.includes('@gmail.com')
let corr2=email.includes("@hotmail.com")
if(!corr && !corr2){
labele=document.getElementById('lab-email').innerHTML='Looks like this is not an email';
div.classList.add("visivel")
imgs.classList.add("vi");
}else{
labele=document.getElementById('lab-email').innerHTML='';
div.classList.remove("visivel")
imgs.classList.remove("vi");
}
}
if(password===''){
var labelp=document.getElementById('lab-password').innerHTML='Password cannot be empty';
let imgs=document.getElementById('ic-img4')
let div=document.getElementById("img4")
imgs.classList.add("vi");
div.classList.add("visivel")
}else{
labelp=document.getElementById('lab-password').innerHTML='';
let imgs=document.getElementById('ic-img4')
imgs.classList.remove("vi");
let div=document.getElementById("img4")
div.classList.remove("visivel")
}
}