javascriptjqueryintl-tel-input

Get the full number using intlTelInput


I am using the demo code for intlTelInput provided here

I am able to get the dial code using following

var intlNumber = $("#phone").intlTelInput("getSelectedCountryData");

But i am not able to get the full number i.e. "dialcode + number entered by user" from the #phone text box.


Solution

  • Use the getnumber option, so in your case:

    var intlNumber = $("#phone").intlTelInput("getNumber");

    ^ This will give you the entire number (country code + phone number)

    See docs here.