M
M
Mixa19872018-02-22 09:29:51
JavaScript
Mixa1987, 2018-02-22 09:29:51

How to make the cursor always be at the beginning in the phone mask?

When you click on the phone input field of the pop-up form, you need the cursor to automatically go to the very beginning, now it’s very difficult to get, then in the middle then at the end, you need to click on any area to get to the very beginning.
The script for the mask now looks like this:

jQuery(function($){
       $("#pop_phone").mask("+7(999) 999-9999");
    });

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
Nikolai Pinevich, 2019-05-31
@Afres

Here 's a better solution, in my opinion.

M
Mixa1987, 2018-02-22
@Mixa1987

what you threw in the same place still the cursor does not rise to the beginning

A
Ainur Valiev, 2018-02-22
@vaajnur

pos = checkVal(); replace with pos = 0 in bib

D
dimsonbgg, 2021-10-22
@dimsonbgg

This is done very simply, look, after +7 you have _____. And because of it, the cursor is placed at the end. We just remove the underscore and the cursor will always fall after +7 and besides, with the ability to edit the number without erasing :)

jQuery(function($){
       $("#pop_phone").mask("+7(999) 999-9999", {placeholder: "" });
    });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question