-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjqueryy.js
More file actions
109 lines (94 loc) · 3.08 KB
/
jqueryy.js
File metadata and controls
109 lines (94 loc) · 3.08 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
$(document).ready(function(){
$("#validation").validate({
rules:{
username:{
required:true,
minlength:5,
maxlength:8
},
password:{
required:true,
minlength:8
},
cpassword:{
required:true,
minlength:8,
equalTo:"#pass"
},
gender:{
required:true
},
Dob:{
required:true
},
phone:{
required:true,
minlength:10,
maxlength:10
},
email:{
required:true,
email:true
}
}
})
})
$(document).ready(function(){
$("#pass").keyup(function(){
check_pass();
});
$("#pass_type").mouseleave(function(){
$(this).hide()
})
});
function check_pass()
{
var val=document.getElementById("pass").value;
var meter=document.getElementById("meter");
var no=0;
if(val!="")
{
// If the password length is less than or equal to 6
if(val.length<=6)no=1;
// If the password length is greater than 6 and contain any lowercase alphabet or any number or any special character
if(val.length>6 && (val.match(/[a-z]/) || val.match(/\d+/) || val.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/)))no=2;
// If the password length is greater than 6 and contain alphabet,number,special character respectively
if(val.length>6 && ((val.match(/[a-z]/) && val.match(/\d+/)) || (val.match(/\d+/) && val.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/)) || (val.match(/[a-z]/) && val.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/))))no=3;
// If the password length is greater than 6 and must contain alphabets,numbers and special characters
if(val.length>6 && val.match(/[a-z]/) && val.match(/\d+/) && val.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/))no=4;
if(no==1)
{
$("#meter").animate({width:'50px'},300);
meter.style.backgroundColor="red";
document.getElementById("pass_type").innerHTML="Very Weak";
$("#pass_type").css({"color":"red"})
}
if(no==2)
{
$("#meter").animate({width:'100px'},300);
meter.style.backgroundColor="#F5BCA9";
document.getElementById("pass_type").innerHTML="Weak";
$("#pass_type").css({"color":"red"})
}
if(no==3)
{
$("#meter").animate({width:'150px'},300);
meter.style.backgroundColor="#FF8000";
document.getElementById("pass_type").innerHTML="Good";
$("#pass_type").css({"color":"orange"})
}
if(no==4)
{
$("#meter").animate({width:'200px'},300);
meter.style.backgroundColor="#00FF40";
document.getElementById("pass_type").innerHTML="Strong";
$("#pass_type").css({"color":"green"})
}
}
else
{
meter.style.backgroundColor="white";
document.getElementById("pass_type").innerHTML="";
$("#pass_type").css({"color":"white"})
}
}