Skip to content

Instantly share code, notes, and snippets.

@jonbjornn
Created May 10, 2017 22:53
Show Gist options
  • Save jonbjornn/89ca159f2b40815bfe54ada1262fd467 to your computer and use it in GitHub Desktop.
Save jonbjornn/89ca159f2b40815bfe54ada1262fd467 to your computer and use it in GitHub Desktop.
<script>
/**
* Do not remove this section; it allows our team to troubleshoot and track feature adoption.
* TS:0002-07-017
*/
lp.jQuery(function($) {
// Replace email_address with the actual ID of your form field.
var field = 'email_address';
// Optionally change this to customize the validation error that your visitors will see if they enter a webmail address.
var message = 'Please enter your work mail address.';
var rules = module.lp.form.data.validationRules[field];
$.validator.addMethod('notWebmail', function(value, field) {
var valid = /\@(?!(me|mac|icloud|gmail|googlemail|hotmail|live|msn|outlook|yahoo|ymail|aol)\.)/.test(value.toLowerCase());
return valid || (!rules.required && !value);
}, message);
rules.notWebmail = true;
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment