For installation and configuration details about the script, see the main github readme.
Let's start with a simple, no-frills example. You can lay the fields out in your markup - as this one demonstrates - however you want - but for simplicity, the rest of the examples will just put them side to side.
Custom default option texts for both the country and region dropdowns.
The country dropdown values are by default the same as the display values: the full country names. By adding the data-value="shortcode" attribute to the country field, the values will be a 2-char character code. See Example 8 for a similar example with the region dropdown.
Pre-filling the fields on page load.
Manual initialization for dynamically inserted DOM content.
Whitelisting a subset of countries to limit what appears. This just shows the UK, United States and Canada.
This example does the reverse of the previous: it blacklists a list of countries, so all EXCEPT those countries show up. In this case it blacklists all countries beginning with letter A.
This demos the
data-value="shortcode" option for the region field. Like with data-value setting
on the country field, this option changes the value attribute of region dropdowns so a shorter version
of the region is passed to the server (e.g. BC instead of British Columbia). Please note: not all
region shortcodes have been entered yet, so if there isn't anything available it will fallback to the
full region name. If you're storing this info in a DB, make sure to allocate enough room!