Answer the question
In order to leave comments, you need to log in
Where is the syntax error in the code?
Does not fulfill part of the condition. To make it clear, I will describe the principle verbally. A test is displayed in the input if: enable == true (the input is not completely filled), or valid == false (there are no matches for characters).
Here is the part of the code that is responsible for this condition
, so when we initially entered the conditions into the input, all checks work out well. But when we start deleting or changing characters in the input, all checks stop working correctly.
What could be the reason for this code behavior?
here is the whole condition code: : } else if (enable == true && valid == false ) {
var phone = this.value;
if (!phone || phone.replace(/\D/g, '').length < 12) enable = false;
if (codes[phone.substr(5, 3)]) {
valid = true
} else if (enable == true && valid == false ) {
$('.form-control').val('Некорректный ввод');
}
if (enable == false && valid == true) {
obj = {
dates: 'дата',
time: 'время',
phone: phone
};
obj['date'] = retite
alert(obj['date']);
}
}).end().end()
Answer the question
In order to leave comments, you need to log in
If I understood you correctly, you need this result: jsfiddle.net/Murmurianez/62uzw6sa
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question