Advertisement
Guest User

Untitled

a guest
Mar 21st, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //--ПРОВЕРКА EMAIL НАЧАЛО--
  2. var formIsValid = false;
  3.  
  4. function checkEmail( el ) {
  5.   var reg = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
  6.   if(reg.test( el )) {
  7.     $('.correct').fadeIn(500);
  8.     formIsValid = true;
  9.     return true;
  10.   } else {
  11.     $('.incorrect').fadeIn(500);
  12.     return false;
  13.   }
  14. };
  15.  
  16. //--ПРОВЕРКА EMAIL КОНЕЦ--
  17.  
  18.  
  19.  
  20. $(function () {
  21.  $('button.bnt-openform').click(function () {
  22.   $('div.'+$(this).attr("rel")).fadeIn(500);
  23.   $("body").append("<div id='overlay'></div>");
  24.   $('#overlay').show().css({'filter' : 'alpha(opacity=80)'});
  25.   return false;
  26.  });
  27.  $('a.close').click(function () {
  28.   $(this).parent().fadeOut(100);
  29.   $('#overlay').remove('#overlay');
  30.   return false;
  31.  });
  32.  $('form').on('submit', function(e) {
  33.   checkEmail( $('input[name="email"]').val() );
  34.   if (formIsValid === false) {
  35.     e.preventDefault();
  36.   }
  37. })
  38. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement