Skip to content

Commit cfd9645

Browse files
committed
Fixed bug in validateEmail()
1 parent a1a86e1 commit cfd9645

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

jquery.formvalidator.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* (c) 2011 Victor Jonsson, Sweden.
99
* Dual licensed under the MIT or GPL Version 2 licenses
1010
*
11-
* $version 1.2
11+
* $version 1.3.beta
1212
*/
1313

1414
(function($) {
@@ -320,9 +320,14 @@ jQueryFormUtils.defaultBorderColor = null;
320320
* @return {Boolean}
321321
*/
322322
jQueryFormUtils.validateEmail = function(email) {
323-
// TODO: is this regexp enough for validating email correct?
324323
var emailFilter = /^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+.)+([a-zA-Z0-9]{2,4})+$/;
325-
return emailFilter.test(email);
324+
if(emailFilter.test(email)) {
325+
var parts = email.split('@');
326+
if(parts.length == 2) {
327+
return jQueryFormUtils.validateDomain(parts[1]);
328+
}
329+
}
330+
return false;
326331
};
327332

328333
/**

0 commit comments

Comments
 (0)