Skip to content

Instantly share code, notes, and snippets.

@fnalin
Created May 26, 2014 17:33
Show Gist options
  • Save fnalin/a76890b974041e08f5a6 to your computer and use it in GitHub Desktop.
Save fnalin/a76890b974041e08f5a6 to your computer and use it in GitHub Desktop.
Extensão do jQuery-Validate
/*
* Localized default methods for the jQuery validation plugin.
* Locale: PT_BR
*/
jQuery.extend(jQuery.validator.methods, {
date: function (value, element) {
return this.optional(element) || /^\d\d?\/\d\d?\/\d\d\d?\d?$/.test(value);
},
number: function (value, element) {
return this.optional(element) || /^-?(?:\d+|\d{1,3}(?:\.\d{3})+)(?:,\d+)?$/.test(value);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment