I am trying to generate the telephone input field and I have got success.
Requirement 1: Need to display Country flag along with the country name as soon the dropdown requirement 2: once the country is got selected it would display the country code in the next text filed.
the output would be like this:
$("#mobile-number").intlTelInput({
initialCountry: "auto",
geoIpLookup: function(callback) {
$.get('https://ipinfo.io', function() {}, "jsonp").always(function(resp) {
var countryCode = (resp && resp.country) ? resp.country : "";
callback(countryCode);
});
},
utilsScript: "https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/11.0.9/js/utils.js" // just for formatting/placeholders etc
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://www.jquery-az.com/jquery/js/intlTelInput/intlTelInput.js"></script>
<link href="https://www.jquery-az.com/jquery/css/intlTelInput/demo.css" rel="stylesheet" />
<link href="https://www.jquery-az.com/jquery/css/intlTelInput/intlTelInput.css" rel="stylesheet" />
<h1>A demo with IP lookup</h1>
<form style="margin-left:150px;">
<input type="tel" id="mobile-number" placeholder="e.g. +1 702 123 4567">
</form>