fix 16.11

This commit is contained in:
Kirill Pet
2024-11-16 17:50:55 +03:00
parent fe7909e9cc
commit c344dbcd43
5 changed files with 82 additions and 69 deletions

View File

@@ -173,9 +173,6 @@ function remoteControl(main, button) {
subject = document.querySelector(`.${subjectClass}`),
buttons = Array.from(main.querySelectorAll(button));
console.log(main);
main.addEventListener('click', function (eventMain) {
setTimeout(() => {
let indexActive = buttons.findIndex((button, index) => {
@@ -194,18 +191,52 @@ function remoteControl(main, button) {
})
}
// formCheck('.modal-form__content', 'input[type=submit]');
// formCheck('.modal-map__form', 'input[type=submit]');
formCheck('.modal-form__content', 'input[type=submit]');
formCheck('.modal-map__form', 'input[type=submit]');
// function formCheck(form, submit) {
// let forms = document.querySelectorAll(form);
function formCheck(form, submit) {
let forms = document.querySelectorAll(form);
// forms.forEach(form => {
// let thisSubmit = form.querySelector(submit);
forms.forEach(form => {
let thisSubmit = form.querySelector(submit);
// thisSubmit.onclick = function () {
// form.classList.add('check')
// }
thisSubmit.onclick = function () {
form.classList.add('check')
}
// })
// }
})
}
inputPhoneNoFlag('.no-flag');
function inputPhoneNoFlag(input){
let inputs = document.querySelectorAll(input);
inputs.forEach(input => {
let code = '+' + input.dataset.code;
input.onfocus = function () {
if (input.value == '') {
input.value = code;
}
}
input.addEventListener('input', function(event) {
let text = event.target.value;
let length = text.length;
let newSymbol = event.data;
if (isNaN(event.data) || event.data == ' ') {
event.target.value = text.slice(0, -1);
return;
}
if (length == 3 || length == 7 || length == 11) {
if (newSymbol != null) {
event.target.value = text.slice(0, -1) + ' ' + newSymbol;
}
}
})
})
}