Commit 845cd527562e0cd3be65b934741b31d84b375ad8
1 parent
a528e647
- phones mask
Showing
1 changed file
with
6 additions
and
9 deletions
Show diff stats
frontend/web/js/script.js
| @@ -143,24 +143,21 @@ $(document).ready(function() { | @@ -143,24 +143,21 @@ $(document).ready(function() { | ||
| 143 | }) | 143 | }) |
| 144 | 144 | ||
| 145 | } | 145 | } |
| 146 | - | 146 | + |
| 147 | 147 | ||
| 148 | 148 | ||
| 149 | function phoneMask() { | 149 | function phoneMask() { |
| 150 | var phoneInput = '.phones_mask input' | 150 | var phoneInput = '.phones_mask input' |
| 151 | 151 | ||
| 152 | - if($('body').find('.phones_mask').find('input').length>0){ | ||
| 153 | - $(phoneInput).mask('(000) 000-00-00',{placeholder:'(0__)___-__-__'}); | 152 | + if($('body').find(phoneInput).length>0){ |
| 153 | + $(phoneInput).mask('+38(000)000-00-00',{placeholder:'+38(000)000-00-00'}); | ||
| 154 | $(phoneInput).focus(function () { | 154 | $(phoneInput).focus(function () { |
| 155 | - | ||
| 156 | - var text = $(this).val(); | ||
| 157 | - $(this).val(text); | ||
| 158 | - if(($(this).val())== '') {$(this).val('(0')} | ||
| 159 | - }); | 155 | + if(($(this).val())== '') {$(this).val('+38(0')} |
| 156 | + }) | ||
| 160 | $(phoneInput).focusout(function () { | 157 | $(phoneInput).focusout(function () { |
| 161 | var phoneVal = $(this).val() | 158 | var phoneVal = $(this).val() |
| 162 | //if(phoneVal == '+38(0' || phoneVal == '+38(' || phoneVal == '+38' || phoneVal == '+3' || phoneVal == '+') {$(this).val('')} | 159 | //if(phoneVal == '+38(0' || phoneVal == '+38(' || phoneVal == '+38' || phoneVal == '+3' || phoneVal == '+') {$(this).val('')} |
| 163 | - if(phoneVal.length <15) {$(this).val('')} | 160 | + if(phoneVal.length <17) {$(this).val('')} |
| 164 | }) | 161 | }) |
| 165 | } | 162 | } |
| 166 | } | 163 | } |