0

I try create a fixed input mask with javascript library https://github.com/RobinHerbots/Inputmask

This is my code:

$(document).ready(function(){
  $("#phone-1").inputmask("+996 999 999999",{ "clearIncomplete": true });
});

I want to have +996 fixed and user can type other numbers only, how can I do this ?

0

1 Answer 1

1

You need to escape the static elements which are equal to a definition.
See https://github.com/RobinHerbots/Inputmask#escape-special-mask-chars

$(document).ready(function(){
  $("#phone-1").inputmask("+\\9\\96 999 999999",{ "clearIncomplete": true });
});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.