Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //--ПРОВЕРКА EMAIL НАЧАЛО--
- var formIsValid = false;
- function checkEmail( el ) {
- 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,}))$/;
- if(reg.test( el )) {
- $('.correct').fadeIn(500);
- formIsValid = true;
- return true;
- } else {
- $('.incorrect').fadeIn(500);
- return false;
- }
- };
- //--ПРОВЕРКА EMAIL КОНЕЦ--
- $(function () {
- $('button.bnt-openform').click(function () {
- $('div.'+$(this).attr("rel")).fadeIn(500);
- $("body").append("<div id='overlay'></div>");
- $('#overlay').show().css({'filter' : 'alpha(opacity=80)'});
- return false;
- });
- $('a.close').click(function () {
- $(this).parent().fadeOut(100);
- $('#overlay').remove('#overlay');
- return false;
- });
- $('form').on('submit', function(e) {
- checkEmail( $('input[name="email"]').val() );
- if (formIsValid === false) {
- e.preventDefault();
- }
- })
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement