Skip to content

Instantly share code, notes, and snippets.

@thiamteck
Created May 13, 2011 10:13
Show Gist options
  • Select an option

  • Save thiamteck/970297 to your computer and use it in GitHub Desktop.

Select an option

Save thiamteck/970297 to your computer and use it in GitHub Desktop.
JQuery validator method for checking integer that not start with zero
jQuery.validator.addMethod("numberNotStartWithZero", function(value, element) {
return this.optional(element) || /^[1-9][0-9]+$/i.test(value);
}, "Please enter a valid number. (Do not start with zero)");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment