Country-region-selector

A script to automatically add dynamic, connected country and region dropdowns to your forms.

Download .zip Download .tar.gz View on GitHub

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

Just view the page source code to see how the following examples work. There's no javascript you have to enter: you just need to add specific attributes to your <select> tags.

Examples

Example 1

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.

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.