Jquery: maskedinput plugin doesn't play well with validation plugin

Just started with jquery, and I'm trying to get form validation to work with a validation plugin . Then I discovered the maskedinput plugin ( http://digitalbush.com/projects/masked-input-plugin/ ) and tried to use it in the phone number field.

Things work to a certain extent: When the phone’s field is in focus, it displays place holders and allows you to enter a phone number and limits you to numbers - very nice!

However, if you enter only 9 digits instead of the required 10 (provided that the phone number is in the USA), yes, it is unlikely, but more crazy stuff has and will happen, and you click submit, then everything that was already in the phone field is cleared . If you enter the entire phone number and the verification fails in another field, the entry in the telephone field will be blocked.

How can I prevent this?

Thanks HGG

+3
source share
1 answer

, , , , 9/10 , , , ,

0

Source: https://habr.com/ru/post/1728472/


All Articles