Validation with jQuery

Sharing is caring!

This time I need to clarify about “Form acceptance utilizing standard outflows with jquery”. I had advanced an excercise utilizing jquery.validate plugin, It’s extremely straightforward. Actualize this and improve your web tasks.

http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js
http://jquery.validate.js

$(document).ready(function() {
$.validator.addMethod(“email”, function(value, element)
{
return this.optional(element) || /^[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+.[a-zA-Z.]{2,5}$/i.test(value);
}, “Please enter a valid email address.”);

$.validator.addMethod(“username”,function(value,element)
{
return this.optional(element) || /^[a-zA-Z0-9._-]{3,16}$/i.test(value);
},”Username are 3-15 characters”);

$.validator.addMethod(“password”,function(value,element)
{
return this.optional(element) || /^[A-Za-z0-9!@#$%^&*()_]{6,16}$/i.test(value);
},”Passwords are 6-16 characters”);

// Validate signup form
$(“#signup”).validate({
rules: {
email: “required email”,
username: “required username”,
password: “required password”,
},
});
});

Download Script

One thought on “Validation with jQuery

Leave a Reply

Your email address will not be published. Required fields are marked *

Got Project on mind? Let's ConnectContact Us

Secured By miniOrange