I am using the jquery validate function and plugin located here. http://docs.jquery.com/Plugins/Validation
I am going thrue the js file and i have found the email va
You can extend it and add your own rule.
jQuery.validator.addMethod("edu", function(value, element) {
// Make it work optionally OR
// Check the last 4 characters and ensure they match .edu
return (this.optional(element) || value.slice(-4) == ".edu");
}, "You must use a .edu email address");
$("#myform").validate({
rules: {
field: {
required: true,
email: true,
edu: true
}
}
});
Here is a jsfiddle showing how it all works together and how the errors cascade. Just press the button.