@berlinsms/country-picker

1.0.5 • Public • Published

jQuery CountryPicker

Homepage

Description

A jquery-plugin to pick a country-code in a formular

Usage

Download js and css for bsms-country-picker

https://static.berlinsms.de/toolsforcoder/country-picker/dist/bsms-country-picker.min.js
https://static.berlinsms.de/toolsforcoder/country-picker/distbsms-country-picker.css

Include jquery and js+css for bsms-country-picker

<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link rel="stylesheet" href="bsms-country-picker.css">
<script src="bsms-country-picker.min.js"></script>

Find your jquery-container and assign country-picker

$('.plugin-container').bsmsCountryPicker();    

Make sure, the script is fully loaded, before you assign country-picker, e.g. use jquerys 'ready'

$(document).ready(()=>{
    $('.plugin-container').bsmsCountryPicker();
});    

Add options, if needed:

$(document).ready(function() {
	$('.country-picker-container').bsmsCountryPicker({
		countries: { 
			"AT": { name:"�sterreich",  code:"+43"} ,
			"DE": { name:"Deutschland", code:"+49"}, 
			"CH": { name:"Schweiz",     code:"+41"}, 
		}, 
		defaultCountry: "DE"
	});
});   

Options

Option DESCRIPTION DEFAULT
countries Dictionary of available countries, each key must be an uniqued identifier of a country, values are dictionaries of name and code of the country all countries
defaultCountry identifier of a country, which ist selected initialy, has to be a key in the countries-dictionary DE
inputName name-attribute of a hidden input-tag, which the plugin includes to the form bsms-country-code

Package Sidebar

Install

npm i @berlinsms/country-picker

Weekly Downloads

1

Version

1.0.5

License

MIT

Unpacked Size

72.6 kB

Total Files

11

Last publish

Collaborators

  • berlinsms-dev
  • alexw_berlinsms
  • hagen.meutzner