Skip to content

Commit 705cb51

Browse files
Commit with jQuery
1 parent c43d50c commit 705cb51

File tree

2 files changed

+97
-9
lines changed

2 files changed

+97
-9
lines changed

index.html

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,60 @@
88
<meta http-equiv="x-ua-compatible" content="ie=edge">
99
<meta name="viewport" content="width=device-width, initial-scale=1">
1010
<link rel="stylesheet" type="text/css" href="css/sigup.css">
11+
12+
13+
<!--JQuery Links-->
14+
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
15+
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.0/jquery.validate.min.js"></script>
16+
<script>
17+
$(document).ready(function () {
18+
$("#signupform").validate({
19+
rules: {
20+
email: {
21+
required: true
22+
},
23+
password: {
24+
required: true,
25+
minlength:6
26+
},
27+
contact:{
28+
required:true,
29+
minlength:10,
30+
maxlength:10,
31+
},
32+
repassword:{
33+
required:true,
34+
minlength:6,
35+
36+
}
37+
},
38+
messages: {
39+
email: {
40+
required: "Email is required"
41+
},
42+
password: {
43+
required: "Password is required",
44+
minlength:"Password must be of at least 6 characters"
45+
},
46+
contact:{
47+
required: "Contact No. is required",
48+
minlength:"Provided length is not valid",
49+
maxlength:"Provided length is not valid"
50+
},
51+
repassword:{
52+
required:"Re-password is required",
53+
minlength:"Re-password must be same as Password",
54+
55+
}
56+
},
57+
submitHandler: function (form) { // for demo
58+
document.location.href = "home.html";
59+
}
60+
});
61+
});
62+
</script>
63+
64+
1165
</head>
1266
<body class="align">
1367

@@ -18,26 +72,26 @@
1872
<img src="images/icons8-registration-48.png">
1973
<h2>Sign Up</h2>
2074

21-
<form action="home.html" class="form">
75+
<form action="home.html" class="form" id="signupform">
2276

2377
<div class="form__field">
24-
<input type="email" placeholder="Email">
78+
<input type="email" placeholder="Email" name="email">
2579
</div>
2680

2781
<div class="form__field">
28-
<input type="tel" placeholder="Contact No." pattern="[0-9]{10}">
82+
<input type="tel" placeholder="Contact No." pattern="[0-9]{10}" name="contact">
2983
</div>
3084

3185
<div class="form__field">
32-
<input type="password" placeholder="Password">
86+
<input type="password" placeholder="Password" name="password">
3387
</div>
3488

3589
<div class="form__field">
36-
<input type="password" placeholder="Re-Password">
90+
<input type="password" placeholder="Re-Password" name="repassword" >
3791
</div>
3892

3993
<div class="form__field">
40-
<input type="submit" value="Sign Up">
94+
<input type="submit" value="Sign Up"s>
4195
</div>
4296

4397
</form>

login.html

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,40 @@
77
<meta http-equiv="x-ua-compatible" content="ie=edge">
88
<meta name="viewport" content="width=device-width, initial-scale=1">
99
<link rel="stylesheet" type="text/css" href="css/sigup.css">
10+
11+
12+
<!--JQuery Links-->
13+
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
14+
<script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.13.0/jquery.validate.min.js"></script>
15+
<script>
16+
$(document).ready(function () {
17+
$("#loginform").validate({
18+
rules: {
19+
email: {
20+
required: true
21+
},
22+
password: {
23+
required: true,
24+
minlength:6,
25+
}
26+
},
27+
messages: {
28+
email: {
29+
required: "Email is required"
30+
},
31+
password: {
32+
required: "Password is required",
33+
minlength:"Password must be of at least 6 characters"
34+
}
35+
},
36+
submitHandler: function (form) { // for demo
37+
document.location.href = "home.html";
38+
}
39+
});
40+
});
41+
</script>
42+
43+
1044
</head>
1145
<body class="align">
1246

@@ -17,14 +51,14 @@
1751
<img src="images/icons8-lock-48.png">
1852
<h2>Login</h2>
1953

20-
<form action="home.html"class="form">
54+
<form action="home.html"class="form" id="loginform">
2155

2256
<div class="form__field">
23-
<input type="email" placeholder="Email">
57+
<input type="email" placeholder="Email" name="email">
2458
</div>
2559

2660
<div class="form__field">
27-
<input type="password" placeholder="Password">
61+
<input type="password" placeholder="Password" name="password">
2862
</div>
2963

3064
<div class="form__field">

0 commit comments

Comments
 (0)