This time I will share jQuery Plugin and tutorial about Country Calling Code Picker With Flags – jQuery ccpicker.js, hope it will help you in programming stack.
ccpicker.js is a lightweight Country Code Picker plugin which enables the user to select International Calling Codes from a flag dropdown list.
How to use it:
1. Insert jQuery JavaScript library and the jQuery ccpicker plugin’s files into your web page.
2 |
integrity = "sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" |
3 |
crossorigin = "anonymous" > |
5 |
< script src = "js/jquery.ccpicker.js" ></ script > |
6 |
< link rel = "stylesheet" href = "css/jquery.ccpicker.css" > |
2. Call the plugin to append the Country Code Picker to your input field.
1 |
< input type = "text" id = "phoneField" name = "phoneField" class = "phone-field" > |
1 |
$( "#phoneField" ).CcPicker(); |
3. Set the pre-selected Country Code.
1 |
$( "#phoneField" ).CcPicker({ |
4. Set the Country Code manually.
1 |
$( "#phoneField" ).CcPicker( "setCountryByCode" , "es" ); |
5. By default, the plugin loads Country Code data from data.json
via AJAX. You can define the data source in the JavaScript as this:
1 |
$( "#phoneField" ).CcPicker({ |
Changelog:
2020-07-17
- Update jquery.ccpicker.js
2018-11-07
2018-03-06
This awesome jQuery plugin is developed by fr33land. For more Advanced Usages, please check the demo page or visit the official website.