forked from ashiscs/Advanced-Registration-form
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jquery.html
197 lines (154 loc) · 3.34 KB
/
jquery.html
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<html>
<head>
<title>jquery</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<style>
body{
font-family:helvetica, sans-serif;
font-size:130%;
width: 100wh;
height: 90vh;
color: #fff;
background: linear-gradient(-45deg, #EE7752, #E73C7E, #23A6D5, #23D5AB);
background-size: 400% 400%;
-webkit-animation: Gradient 15s ease infinite;
-moz-animation: Gradient 15s ease infinite;
animation: Gradient 15s ease infinite;
}
@-webkit-keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
@-moz-keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
@keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}
input{
padding:5px 5px 12px 5px;
font-size:25px;
border-radius: 5px;
border:1px solid grey;
width:320px;
}
label{
position:relative;
top:12px;
float:left;
width:200px;
}
#ab{
width:550px;
margin:0 auto;
}
.form{
margin-bottom: 10px;
}
#submit{
width:130px;
margin-left:200px;
cursor: pointer;
}
#error{
color: red;
font-size:110% !important;
}
#success{
color: green;
font-size:110% !important;
display:none;
margin-bottom: 20px;
}
</style>
</head>
<body>
<div id="ab">
<div id="success">You did it! Congratulations.</div>
<div id="error"></div>
<div class="form">
<label for="email">Email</label>
<input type="text" name="email" id="email" placeholder="yourname">
</div>
<div class="form">
<label for="phone">Phone</label>
<input type="text" name="phone" id="phone" placeholder="eg.0123456789">
</div>
<div class="form">
<label for="password">Password</label>
<input type="password" name="password" id="password" >
</div>
<div class="form">
<label for="pc">Confirm Password</label>
<input type="password" name="pc" id="pc" >
</div>
<div class="form">
<input type="submit" id="submit" value="Sign Up">
</div>
</div>
<script>
function isEmail(email) {
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
return regex.test(email);
}
$("#submit").click(function(){
var error="";
var field="";
if($("#email").val()==""){
field+="<br>Email";
}
if($("#phone").val()==""){
field+="<br>Phone";
}
if($("#password").val()==""){
field+="<br>Password";
}
if(field!=""){
error+="The following fields are missing: "+field;
}
if($("#pc").val()==""){
field+="<br>Confirm Password";
}
if(isEmail($("#email").val())==false){
error+="<p>your email address is not valid</p>";
}
if($.isNumeric($("#phone").val())==false){
error+="<p>your phone number is not valid</p>";
}
if($("#password").val()!=$("#pc").val()){
error+=",passwords doesn't match";
}
if(error!=""){
$("#error").html(error);
}
else{
$("#success").show();
$("#error").hide();
}
})
</script>
</body>
</html>