-
Notifications
You must be signed in to change notification settings - Fork 0
/
teacher.js~
executable file
·110 lines (77 loc) · 1.55 KB
/
teacher.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
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
$(document).ready(function () {
$("#err").hide();
var semerror,nocerror,ciderror,typeerror,depterror;
$("#semester").blur(function(){
var sem=$("#semester").val();
console.log(sem);
if(sem>8 || sem<1){
$("#semester").css('color','red');
$("#semester").html('<font color="#cc0000">Please enter valid Email address</font>');
semerror=1;
}
else{
semerror=0;
$("#semester").css('color','green');
}
});
$("#cid").blur(function(){
var cid=$("#cid").val();
console.log(cid);
if(cid.length >7 || cid.length<6 || !isAlphaNumeric(cid)){
$("#cid").css('color','red');$("err").val(0);
ciderror=1;
}
else{
$("#cid").css('color','green');
ciderror=0;
}
});
$("#noc").blur(function(){
var cid=$("#noc").val();
console.log(cid);
if(cid>5 || cid < 1){
nocerror=1;
$("err").val(0);
$("#noc").css('color','red');
}
else{
nocerror=0;
$("#noc").css('color','green');
}
});
$("#type").blur(function(){
var cid=$("#type").val();
console.log(cid);
if(!(cid.toLowerCase()==='mandatory'|| cid.toLowerCase()=='elective')){
typeerror=1;
$("#type").css('color','red');
$("err").val(0);
}
else{
typeerror=0;
$("#type").css('color','green');
}
});
$("#dept").blur(function(){
var cid=$("#dept").val();
console.log(cid);
if((cid.len!=7)){
depterror=1;
$("#dept").css('color','red');
}
else{
depterror=0;
$("#dept").css('color','green');
if(typeerror==1 || nocerror==1 || ciderror==1|| semerror==1){
$("#sub").hide();
console.log("Here")
}
else{
$("#sub").show();
}
}});
function isAlphaNumeric(str) {
console.log("Alphanumeric Testing..");
return /^[a-zA-Z0-9 ]+$/.test(str);
}
});