-
-
Notifications
You must be signed in to change notification settings - Fork 134
Expand file tree
/
Copy pathvalidation.js
More file actions
27 lines (22 loc) · 853 Bytes
/
validation.js
File metadata and controls
27 lines (22 loc) · 853 Bytes
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
function check(event){
event.preventDefault();
var email1=document.getElementById('mail');
var passd1=document.getElementById('pswd');
var mailformat = /\S+@\S+\.\S+/;
var passformat=/^(?=.*[0-9])(?=.*[!@#$%^&*])[a-zA-Z0-9!@#$%^&*]{6,16}$/;
if(email1.value.match(mailformat) && passd1.value.match(passformat)){
error.textContent= "Done";
error.style.color = "green";
error.style.marginTop="10px";
error.style.fontSize="1.3rem";
error.style.fontWeight="400px";
}
else{
error.textContent = "Invalid username/email";
error.style.color = "red";
error.style.marginTop="10px";
error.style.fontSize="1.3rem";
error.style.fontWeight="400px";
return false;
}
}