jQuery Plugin To Auto Set Country Calling Codes - phonecode

File Size: 107 KB
Views Total: 8288
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
jQuery Plugin To Auto Set Country Calling Codes - phonecode

phonecode is a jQuery plugin that automatically sets the country calling code with the corresponding flag icon to an input field for the selected country. Great for your international website to help the users quickly enter telephone numbers. Heavily based on the Geosingh API to provide list of all countries with their alpha-2 code and country phone-code. phonecode is free software licensed under the GNU General Public License.

See also:

How to use it:

1. Create a country list that will be populated with all countries provided by the Geosingh API.

<label>Country:</label>
<select class="sCountries"></select>

2. Create a text field to accept telephone numbers.

<label>Phone:</label>
<input type="text" class="phone">

3. Load jQuery JavaScript library and the jQuery phonecode plugin at the end of the html page.

<script src="//code.jquery.com/jquery.min.js"></script>
<script src="phonecode.js"></script>

4. Call the function on the country list and specify the target telephone number input.

$('.sCountries').phonecode({
  setClass:'phone'
});

5. More configuration options with default values.

$('.sCountries').phonecode({
  setClass:'phone',
  bgColor: 'white',
  fontColor: 'black',
  prefix: true
});

About Author:

Author: jaskaranjit singh

Website: http://www.singhcoders.com/phonecode-plugin/


This awesome jQuery plugin is developed by iamsingh. For more Advanced Usages, please check the demo page or visit the official website.