From 845cd527562e0cd3be65b934741b31d84b375ad8 Mon Sep 17 00:00:00 2001 From: Anastasia Date: Thu, 21 Jun 2018 13:56:16 +0300 Subject: [PATCH] - phones mask --- frontend/web/js/script.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/frontend/web/js/script.js b/frontend/web/js/script.js index 31547ae..79d6348 100644 --- a/frontend/web/js/script.js +++ b/frontend/web/js/script.js @@ -143,24 +143,21 @@ $(document).ready(function() { }) } - + function phoneMask() { var phoneInput = '.phones_mask input' - if($('body').find('.phones_mask').find('input').length>0){ - $(phoneInput).mask('(000) 000-00-00',{placeholder:'(0__)___-__-__'}); + if($('body').find(phoneInput).length>0){ + $(phoneInput).mask('+38(000)000-00-00',{placeholder:'+38(000)000-00-00'}); $(phoneInput).focus(function () { - - var text = $(this).val(); - $(this).val(text); - if(($(this).val())== '') {$(this).val('(0')} - }); + if(($(this).val())== '') {$(this).val('+38(0')} + }) $(phoneInput).focusout(function () { var phoneVal = $(this).val() //if(phoneVal == '+38(0' || phoneVal == '+38(' || phoneVal == '+38' || phoneVal == '+3' || phoneVal == '+') {$(this).val('')} - if(phoneVal.length <15) {$(this).val('')} + if(phoneVal.length <17) {$(this).val('')} }) } } -- libgit2 0.21.4