You do not need to configure the extension. You can use the accept() method: http://docs.jquery.com/Plugins/Validation/Methods/accept#extension
// input field <input type="text" id="eduEmail2" name="eduEmail2" value=" abc@123.edu "/> // validation rule eduEmail2: { required: true, email: true, accept: 'edu' }
Full example: http://jsfiddle.net/M5TmU/2/ (based on Brombomb jsfiddle)
UPDATE
After the xecute comment, you can use your own regex pattern. In additional-methods.js you have the " pattern " method (the last in the file):
eduEmail3: { required: true, email: true, pattern: /(\.edu\.\w\w)$/ }
Full example: http://jsfiddle.net/M5TmU/3/
Of course, this is not ideal, but still - you do not need to write your own method :)
ADDITIONAL IMAGE : country domain names have two letters, so \w\w\w? too much - \w\w . Did I leave \w\w\w? in the violin
source share