Skip to content

Commit cf91da3

Browse files
authored
Merge pull request #8 from joseignaciorc/master
Added support for preferredCountries. Fixed issue with data.autoGeoIp
2 parents 2b12160 + a4f1fbd commit cf91da3

File tree

1 file changed

+5
-2
lines changed
  • intl_tel_input/static/intl_tel_input

1 file changed

+5
-2
lines changed

intl_tel_input/static/intl_tel_input/init.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@
55
inputs = $(cssClass);
66

77
inputs.each(function(i, el) {
8+
89
$el = $(el);
910
$realInput = $el.prev();
1011
data = $el.data();
1112
defaultCode = data.defaultCode !== undefined ? data.defaultCode : 'us';
1213
options = {
13-
initialCountry: data.autoGeoIp ? 'auto' : data.defaultCode,
14+
initialCountry: data.autoGeoIp!== undefined ? 'auto' : data.defaultCode,
1415
geoIpLookup: function(callback) {
15-
if (data.autoGeoIp) {
16+
if (data.autoGeoIp!== undefined) {
1617
$.get('//freegeoip.net/json/', function() {}, "jsonp").done(function(resp) {
1718
var countryCode = (resp && resp.country_code) ? resp.country_code : "";
1819
callback(countryCode);
@@ -26,6 +27,8 @@
2627
};
2728

2829
options.utilsScript = 'https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/9.0.1/js/utils.js';
30+
options.preferredCountries = data.preferredCountries,
31+
2932

3033
$el.intlTelInput(options)
3134
.done(function() {

0 commit comments

Comments
 (0)