-1

I have used International Telephone Input at my webpage. The problem is, user can type anything at the <input type="tel">. But, if you look on this fiddle, you will see that user can type only plus sign as first character, they have to type number for the remaining. Also, if you copy this, '+880 1x xxxxxxxx ' and paste on that input, it'll keep only '+880 1' How to do that? I am not seeing any additional code for achieving that feature in that fiddle. Can you please take a look on my fiddle and tell me what I can do to achieve those?

My Fiddle

user1896653
  • 3,247
  • 14
  • 49
  • 93

1 Answers1

1

Input type tel is used to mobile devices to change the custom keyboard to number keyboard.

developer.mozilla.org says inputs of type tel are functionally identical to standard text inputs

Unlike input type="email" and input type="url" , the input value is not automatically validated to a particular format before the form can be submitted. So you have to do a normal regex on the text input.

You can find additional info here:

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/tel

And about the initial FIddle link, that seems to use some bootstrap classes which can do what you want, take a look here:

http://js.nicdn.de/bootstrap/formhelpers/docs/phone.html

oma
  • 1,804
  • 12
  • 13