[SOLVED] Do you know why this stopped working?


#1

Hello everyone,

Any tech savvy Unbouncers able to help me resolve this?

I’ve had a jQuery filter emails from outlook/gmail/etc. and it’s been running smoothly for a long time.
All of a sudden, it stopped working yesterday and I can’t find the reason.

Page:
https://eloomi.com/schedule-demo-lp/

Code: (Apologies for the weird unbounce formatting, a copy of it is inserted as a picture instead)
<//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';

// Optionally change this to customize the validation error that your visitors will see if they enter a webmail address.
var message = 'Please use your business e-mail';

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>

Tried removing an exit-intent popup with the same field name as the one on the landingpage, but it didnt resolve it.

Thanks!
Andreas Obel


#2

A fix for anyone running into this:
It’s using a jQuery version from 1846, so it’s taking ages to execute compared to everything else.
Adding a 500ms setTimeout fixed the issued.


#3

Same issue as Adding custom validation to form fields ? (read the last bit)


#4

Actually should have checked the link :wink:

maybe try a doc ready instead of window load?