Skip to content

Instantly share code, notes, and snippets.

@Korveld
Created March 10, 2023 08:20
Show Gist options
  • Select an option

  • Save Korveld/77f63aa91dddebc5550af8b01fce8a60 to your computer and use it in GitHub Desktop.

Select an option

Save Korveld/77f63aa91dddebc5550af8b01fce8a60 to your computer and use it in GitHub Desktop.
Jquery validate plugin add custom rules
$.validator.addMethod('intlTelInput', function (value, element) {
return $(element).intlTelInput("isValidNumber");
}, commonjs_script_env.translate.phone_number);
$.validator.addMethod('emailExt', function(value, element, param) {
return value.match(/^[a-zA-Z0-9_\.%\+\-]+@[a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,}$/);
}, commonjs_script_env.translate.email);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment