Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bindInputsValidation = function() {
- 'use strict';
- var $emailInput, $phoneInput, invalidClass, isEmail;
- $phoneInput = $(".input[type='tel']");
- $emailInput = $(".input[type='email']");
- invalidClass = 'input-wrapper_invalid';
- isEmail = function(email) {
- return !!email.match(/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i);
- };
- $emailInput.blur(function() {
- var value;
- value = $(this).val();
- if (!isEmail(value) && value !== '') {
- return $(this).parent().addClass(invalidClass);
- }
- });
- $('.input').focus(function() {
- return $(this).parent().removeClass(invalidClass);
- });
- return $phoneInput.mask("+375 (99) 999-99-99");
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement