Skip to content

Instantly share code, notes, and snippets.

@davidalencar
Created January 27, 2014 19:08
Show Gist options
  • Save davidalencar/8655347 to your computer and use it in GitHub Desktop.
Save davidalencar/8655347 to your computer and use it in GitHub Desktop.
validate_ptbr
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