0

I have a country select (in SlimSelect) with codes and a [type=tel] input with inputmask. I insert country codes (var takeIndex) to the mask, but inputmask doesn't show number 9 if it exists in code. I added "\" to the mask and now it is showing the first number 9, but in code like +995 it shows only +95. How can I have correct codes? Maybe I should change default value for numerics, but I haven't found how can I do this.

$('input_phone_number').inputmask({mask: '+\\'+takeIndex+'9{10,13}', greedy: false, placeholder: ''});
Mary
  • 25
  • 6
  • Possible duplicate of [Escape Number 9 in p:inputmask](https://stackoverflow.com/questions/39913451/escape-number-9-in-pinputmask) – borchvm Sep 25 '19 at 09:13

2 Answers2

1

This should work mask: "+\9\95 999 9999"

  • Hello and Welcome to Stack Overflow! Please note that it's always good to add more details and full codes to make good answers since other developers could view and use them later. – Anas Abu Farraj Mar 17 '19 at 19:07
0

Number 9 is used as mask for all the digits, if you want to use 9, change the mask using JavaScript, by redefining x as mask :

$.mask.definitions['9'] = '';
$.mask.definitions['x'] = '[0-9]';

Now you can use x as mask:

$('input_phone_number').inputmask({mask: '+\\'+takeIndex+'x{10,13}', greedy: false, placeholder: ''});
Victor Leontyev
  • 8,488
  • 2
  • 16
  • 36