Jquery validator for Phone Number and confirm password
Jquery validator
The Jquery validator we can implement validations in two ways:- Inline validations
- Validate method
for more information go through the below link
http://jqueryvalidation.org/documentation/
Here give code work for the valid phone number and confirm the password.
Script
<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.10.3.css">
<script src="js/jquery.validate.js" type="text/javascript"></script>
$("#formsubmit").live( 'click', function() {
$("#qApply").validate({
rules: {
phonenumber: {
min:7000000000
},
password2: {
equalTo: "#password"
}
},
messages: {
phonenumber: {
min: "Please enter a valid phone number"
},
password2: {
equalTo: "Please enter the same password as above"
}
},
submitHandler: function(form) {
$(form).submit();
}
});
});
HTML form
<input type="text" id="inputName" placeholder="Name" class="applyinput" name="name" required>
<input type="text" id="phonenumber" placeholder="Phone Number" class="applyinput" name="phonenumber" required number="true" minlength="10" maxlength="10">
<input type="text" id="inputEmail" placeholder="Email" class="applyinput" name="email" required type="email">
<input type="password" id="password" placeholder="Password" class="applyinput" name="password" required>
<input type="password" id="password2" placeholder="Confirm Password" name="password2"
class="applyinput">
<input type="checkbox" name="tandc" required>
I agree to the Terms & Conditions
<input type="submit" class="span10 createbtn" value="Create Account" "formsubmit"></input>
Comments
Post a Comment