V
V
Valeriy19972015-08-27 18:33:37
JavaScript
Valeriy1997, 2015-08-27 18:33:37

How to detect an error in the condition c true false?

Help identify the error in the condition. It should work when there are 12 characters in the input, but it only works when there are 11 characters, although 12 is indicated in the condition. If you put 12 and equal, then this part of the code does not work, which is strict (
here is the part of the code with the condition:

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()


Here is the whole code: jsfiddle.net/0xL0fctq/33

Answer the question

In order to leave comments, you need to log in

4 answer(s)
I
Ilya, 2019-03-09
@rsitnikov75

A similar effect can be implemented in CSS.
https://www.w3schools.com/howto/howto_css_flip_card.asp
https://freefrontend.com/css-flip-cards/

A
Alex, 2019-03-09
@Kozack

Open the browser debugger and look at the implementation. See what animations are connected, what events are hung. Where are they from, from which file, and what files are loaded on the page

E
Eugene Chefranov, 2019-03-09
@Chefranov

Google "Flip card js"

L
Lynn "Coffee Man", 2015-08-27
@Lynn

&should be&&

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question