forked from chalkers/validEmail
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
86 lines (69 loc) · 1.52 KB
/
Copy pathindex.html
File metadata and controls
86 lines (69 loc) · 1.52 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
<!DOCTYPE html>
<html>
<head>
<title>validEmail Example</title>
<style type="text/css">
.error {
color:red;
border:5px solid red;
}
.valid {
color:green;
border:5px solid green;
}
</style>
</head>
<body>
<h1>Invalid</h1>
<p>
<input type="text" value="andrew@chalkley">
</p>
<p>
<input type="text" value="andrewchalkley.org">
</p>
<p>
<textarea>andrew@chalkley</textarea>
</p>
<p>
<textarea>andrewchalkley.org</textarea>
</p>
<h1>Valid</h1>
<p>
<input type="text" value="andrew@chalkley.org">
</p>
<p>
<input type="text" value="andrew@chalkley.co.uk">
</p>
<p>
<input type="text" value="andrew@chalkley.com">
</p>
<p>
<textarea>andrew@chalkley.org</textarea>
</p>
<p>
<textarea>andrew@chalkley.co.uk</textarea>
</p>
<p>
<textarea>andrew@chalkley.com</textarea>
</p>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="../validEmail.js"></script>
<script type="text/javascript">
$("input,textarea").each(function(){
$(this).after("<span>"+$(this).validEmail()+"</span>");
});
$("input").validEmail({on:"focus", success:function(){
$(this).removeClass("error").addClass("valid");
}, failure:function(){
$(this).removeClass("valid").addClass("error");
}});
$("textarea").validEmail({on:"keyup", success:function(){
$(this).removeClass("error").addClass("valid");
}, failure:function(){
$(this).removeClass("valid").addClass("error");
},
testInitially: true
});
</script>
</body>
</html>