fix маски телефона
This commit is contained in:
@@ -274,7 +274,7 @@ phoneInputs.forEach(phoneInput => {
|
||||
let value = phoneInput.value;
|
||||
|
||||
if (value.length == 0) {
|
||||
phoneInput.value += '+7 '
|
||||
phoneInput.value = '+7 '
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,15 +286,24 @@ phoneInputs.forEach(phoneInput => {
|
||||
if (value.charAt(0) == '+' && length == 1) return;
|
||||
|
||||
if (isNaN(data)) {
|
||||
phoneInput.value = data.slice(0, -1)
|
||||
phoneInput.value = value.slice(0, -1);
|
||||
}
|
||||
|
||||
if (typeof data != 'object') {
|
||||
if (length == 6 || length == 10) {
|
||||
if (length == 2 || length == 6 || length == 10) {
|
||||
phoneInput.value = value + ' ';
|
||||
}
|
||||
if (length == 3 || length == 7 || length == 11) {
|
||||
if (data != ' ') {
|
||||
phoneInput.value = value.slice(0, -1) + ' ' + data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (length <= 3) {
|
||||
phoneInput.value = '+7 '
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user