K
K
krispey1022021-06-30 11:20:11
JavaScript
krispey102, 2021-06-30 11:20:11

JS mask for input and event .on keycup?

There is a form and a submit button, the button is activated if all fields are filled. event js responsible for changing the text inside the input -

$('.block-calculator .js-input-validate .style-input').on('input keyup', function(e) { }

This code works, the button is activated and the form can be submitted if text is entered inside the input. The problem is that in the "phone" field there is a mask of the type +7 (999) 999-99-99 and if you enter one number, the submit button will become active, but the problem is that if the phone number is not filled in correctly, then everything written will be erased to the original value, but since the button is active, the form can be submitted, and an empty phone number will be sent to the mail. Is it possible to somehow make a condition, is the phone number filled in correctly?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question