orenchuck

validate email without + and .@ but with +soda_test

May 19th, 2022 (edited)
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (function(){
  2. const emailField = document.querySelector('.' + self.identifier + ' [tabindex] INPUT[name="email"]');
  3.         const submitButton = document.querySelector('.' + self.identifier + ' [tabindex] INPUT[name="submit"]');
  4.         if (emailField) {
  5.             emailField.addEventListener('input', function() {
  6.                 setTimeout(function() {
  7.                     const emailFieldValue = emailField.value;
  8.                     const regexpPlus = /\+/;
  9.                     const regexpTest = /\+soda_test/i;
  10.                     const regexpMail = /\.@/;
  11.                     submitButton.style.pointerEvents = 'auto';
  12.                     if (regexpMail.test(emailFieldValue)) {
  13.                         submitButton.style.pointerEvents = 'none';
  14.                     }
  15.                     if (regexpPlus.test(emailFieldValue)) {
  16.                         submitButton.style.pointerEvents = 'none';
  17.                         if(regexpTest.test(emailFieldValue)) {
  18.                             submitButton.style.pointerEvents = 'auto';
  19.                         }
  20.                     }
  21.                 }, 150);
  22.             });
  23.         }
  24. }();
Add Comment
Please, Sign In to add comment