S
S
Sergey2020-09-09 12:20:04
JavaScript
Sergey, 2020-09-09 12:20:04

How to check on JS the phone number is entered in Input or not?

Good afternoon.

There is an Input field for entering a phone number, in this js field there is a mask for entering a phone number.
It is necessary to understand whether the field is filled in by the user or not?

Previously, I usually checked through length for the length of the entered data, but here a mask is applied - and the console says that there are already 17 characters. How to correctly check the filling of a phone number?

Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nadim Zakirov, 2020-09-09
@oldzas

First, remove all characters except numbers, only then check the length of the phone number.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question