Back

Example: Lookup user's country

Use IP address lookup to set the defaultCountry option to the user's country.

Markup

<input id="phone" type="tel" placeholder="e.g. +1 702 123 4567">

Code

$.get("http://ipinfo.io", function(response) {
  $("#phone").intlTelInput({
    defaultCountry: response.country.toLowerCase()
  });
}, "jsonp");

Result