Back

Example: Modify country data

Use static getCountryData method to update the data to only show localised country names.

Markup

<input id="phone" type="tel">

Code

var countryData = window.intlTelInputGlobals.getCountryData(),
  input = document.querySelector("#phone");

for (var i = 0; i < countryData.length; i++) {
  var country = countryData[i];
  country.name = country.name.replace(/.+\((.+)\)/,"$1");
}

window.intlTelInput(input, {
  utilsScript: "../../build/js/utils.js?1549804213570" // just for formatting/placeholders etc
});

Result