Country-region-selector

A simple, lightweight script that adds a country dropdown that automatically updates a corresponding region dropdown in your forms.

Download .zip Download .tar.gz View on GitHub

For installation and configuration details about the script, see the main github readme.

Examples

Example 1

This is a simple no-frills example. You can lay the fields out in your markup however you want - but for simplicity, the rest of the examples will just put them side to side.

Country:
Region:

Example 2

Custom default option texts for both the country and region dropdowns.


Example 3

The country dropdown values are by default the same as the display values: the full country names. By adding the data-value="2-char" attribute to the country field, the values will be a 2-char character code.


Example 4

Pre-filling the fields on page load.