Skip to content

Instantly share code, notes, and snippets.

@chaitu87
Last active July 27, 2016 06:59
Show Gist options
  • Save chaitu87/6d689bad5febb758b8870a95457dc04b to your computer and use it in GitHub Desktop.
Save chaitu87/6d689bad5febb758b8870a95457dc04b to your computer and use it in GitHub Desktop.
// Dealing with Internation ISD Codes
$('input[type="tel"]').intlTelInput({
initialCountry: "auto",
nationalMode: true,
geoIpLookup: function(callback) {
$.get('//ipinfo.io', function() {}, "jsonp").always(function(resp) {
var countryCode = (resp && resp.country) ? resp.country : "";
callback(countryCode);
});
}
});
$('input[type="tel"]').focusout(function(){
console.log($(this).intlTelInput("getNumber"));
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment