<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="jquery.validate.min.js"></script>
</head>
<body>
<form id="register_form">
<input type="text" name="firstname" placeholder="Enter Firstname"/><br/><br/>
<input type="text" name="lastname" placeholder="Enter Lastname"/><br/><br/>
<input type="text" name="mobile" placeholder="Enter Mobile Number"/><br/><br/>
<input type="password" name="password" id="password" placeholder="Enter Password"/><br/><br/>
<input type="password" name="cnf_password" placeholder="Re Enter Password"/><br/><br/>
<input type="submit" value="Submit"/><br/>
</form>
<script>
$("#register_form").validate({
rules :{
firstname : {
required : true
},
lastname :{
required : true
},
mobile :{
required : true,
number : true,
minlength : 10,
maxlength : 10
},
password :{
required : true,
minlength : 6,
maxlength : 32
},
cnf_password :{
required : true,
minlength : 6,
maxlength : 32,
equalTo : '#password'
}
},
messages :{
firstname : {
required : "Please enter firstname"
},
lastname :{
required : "Please enter lastname"
},
mobile :{
required : "Please enter mobile number",
minlength : "Please enter valid 10 digit mobile number",
maxlength : "Please enter valid 10 digit mobile number"
},
password :{
required : "Please enter password",
minlength : "Password should be minimum 6 to maximum 32 characters",
maxlength : "Password should be minimum 6 to maximum 32 characters only"
},
cnf_password :{
required : "Please re enter password",
equalTo : "Confirm Password should match with password"
}
}
});
</script>
</body>
</html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="jquery.validate.min.js"></script>
</head>
<body>
<form id="register_form">
<input type="text" name="firstname" placeholder="Enter Firstname"/><br/><br/>
<input type="text" name="lastname" placeholder="Enter Lastname"/><br/><br/>
<input type="text" name="mobile" placeholder="Enter Mobile Number"/><br/><br/>
<input type="password" name="password" id="password" placeholder="Enter Password"/><br/><br/>
<input type="password" name="cnf_password" placeholder="Re Enter Password"/><br/><br/>
<input type="submit" value="Submit"/><br/>
</form>
<script>
$("#register_form").validate({
rules :{
firstname : {
required : true
},
lastname :{
required : true
},
mobile :{
required : true,
number : true,
minlength : 10,
maxlength : 10
},
password :{
required : true,
minlength : 6,
maxlength : 32
},
cnf_password :{
required : true,
minlength : 6,
maxlength : 32,
equalTo : '#password'
}
},
messages :{
firstname : {
required : "Please enter firstname"
},
lastname :{
required : "Please enter lastname"
},
mobile :{
required : "Please enter mobile number",
minlength : "Please enter valid 10 digit mobile number",
maxlength : "Please enter valid 10 digit mobile number"
},
password :{
required : "Please enter password",
minlength : "Password should be minimum 6 to maximum 32 characters",
maxlength : "Password should be minimum 6 to maximum 32 characters only"
},
cnf_password :{
required : "Please re enter password",
equalTo : "Confirm Password should match with password"
}
}
});
</script>
</body>
</html>
0 comments:
Post a Comment