Phone Number Plugin



A phone number plugin with international flags and phone codes. This is powered by the International Telephone Input Plugin

HTML code
<input type="tel" class="form-control" id="phone-number" placeholder="Phone Number" >

Include CSS code from plugin

<link href="assets/plugins/intl-tel-input-master/css/intlTelInput.css" rel="stylesheet" type="text/css">
                            

Include JavaScript code from plugin

 <script src="assets/plugins/intl-tel-input-master/js/intlTelInput.min.js" type="text/javascript"></script>

Initialize plugin

<script type="text/javascript">

$("#phone-number").intlTelInput({
//Set current country as default country using IP
autoHideDialCode: "false",
preferredCountries: ["gh", "ke", "cm", "ng"],
separateDialCode: true,
initialCountry: "auto",
geoIpLookup: function (callback) {
$.get('http://ipinfo.io', function () {}, "jsonp").always(function (resp) {
var countryCode = (resp && resp.country) ? resp.country : "";
callback(countryCode);
})
}});
</script>
For more options and methods International Telephone Input Documentation