Drop-down list of United States, Canada, and Mexico states or provinces Jul04 '06
Feedback
# (2 of 21): James
3 months, 3 weeks after the fact. (Thu 26 Oct 2006, 9:21 PM CST)
great stuff and very handy! it might also be useful to separate the u.s. states and canadian provinces using the
# (3 of 21): James
3 months, 3 weeks after the fact. (Thu 26 Oct 2006, 9:22 PM CST)
i see this strips element tags - the above should read optgroup element
# (4 of 21): Matthom
3 months, 3 weeks after the fact. (Fri 27 Oct 2006, 6:07 AM CST)
Yes, optgroup is a good idea. Thanks...
# (5 of 21): Lon
9 months, 3 weeks after the fact. (Wed 25 Apr 2007, 1:54 PM CST)
This is a lifesaver. Thanks!!
# (6 of 21): Pat
9 months, 3 weeks after the fact. (Wed 25 Apr 2007, 2:31 PM CST)
Shouldn't DC be grouped with the US states?
# (7 of 21): Matthom
9 months, 3 weeks after the fact. (Wed 25 Apr 2007, 3:54 PM CST)
OK I've made the following changes, based on feedback:
- Added Yukon territory.
- Added
<optgroup>elements to separate "United States" from "Canada." - Moved "District of Columbia" to the United States category, where it belongs.
- Added the abbreviation to the display [ie: Hawaii (HI)], since some users like to search based on the abbreviation.
Thanks for the feedback. Let me know how I can improve it further, in order to make it easier for developers.
# (8 of 21): Nathaniel
10 months, 2 weeks after the fact. (Tue 15 May 2007, 1:22 PM CST)
I am using a similar list, although not as nicely laid out with Optgroup. I recently had an enquiry about adding state/province values for other countries and I found your blog while goodling for such a list. Is this a request you have ever had before? I'm not even sure which countries have postal sub entities that would be equivalent to US states and Canadian provinces.
# (9 of 21): Matthom
10 months, 2 weeks after the fact. (Tue 15 May 2007, 3:02 PM CST)
Nathaniel, I haven't had that request yet. I'm not sure how other countries/regions handle postal codes. I'd be curious to know though.
# (10 of 21): Matthom
11 months after the fact. (Mon 04 Jun 2007, 4:32 PM CST)
UPDATE: Mexico states are now included in the list. I also modified the id attribute to be preceded with the three letter country code, since some of the state codes are duplicated in other countries:
id="MEX-EDM"
The only duplication I noticed so far is "NL," which is used in both Canada and Mexico.
Another thing I noticed is that Mexico codes are inconsistent. Depending on what source you're looking at, sometimes a state has a two-letter abbreviation, and sometimes more.
Please leave a comment if you notice any mistakes.
# (11 of 21): Prateek
1 year, 1 month after the fact. (Tue 14 Aug 2007, 4:59 PM CST)
You saved me lots of time. Thank you soo much
# (12 of 21): Nathaniel Brooks
1 year, 2 months after the fact. (Tue 18 Sep 2007, 12:00 PM CST)
You just saved me a lot of typing. Thanks!
# (13 of 21): Julian
1 year, 3 months after the fact. (Thu 04 Oct 2007, 11:23 AM CST)
Nice thanks a lot for the list!!!
# (14 of 21): Dixon Md
1 year, 4 months after the fact. (Wed 28 Nov 2007, 4:46 PM CST)
This help me very much. Thank you very much
# (15 of 21): Paul
1 year, 6 months after the fact. (Thu 10 Jan 2008, 5:49 AM CST)
This is what the Internet is (supposed to be) about.
I looked for it, I found it!
Thank you for sharing.
# (17 of 21): Timothy Reaves
1 year, 7 months after the fact. (Wed 30 Jan 2008, 7:50 PM CST)
I'm new web developing and this was a huge time saver, I appreciate you thinking about others.
# (18 of 21): Nick
1 year, 9 months after the fact. (Tue 01 Apr 2008, 7:12 PM CST)
Thank you so much for this! Your a time/life-saver!!!!
# (19 of 21): Web Developer
1 year, 9 months after the fact. (Wed 16 Apr 2008, 2:26 PM CST)
thanks dude.
# (20 of 21): Akeem
1 year, 11 months after the fact. (Fri 27 Jun 2008, 3:06 AM CST)
great + cheers from berlin!
# (21 of 21): Scott Vandehey » spaceninja.com
2 years after the fact. (Wed 09 Jul 2008, 11:40 AM CST)
Great list, thanks - you misspelled "Pennsylvania"
RSS feed for comments on this post
Leave feedback
This is for web developers, who quickly need to add a "drop down" list of all the U.S. states, and the provinces in Canada, for a web form.
You are at the feedback permalink page for: Drop-down list of United States, Canada, and Mexico states or provinces
# (1 of 21): Ken
1 week, 6 days after the fact. (Mon 17 Jul 2006, 4:56 PM CST)
Forgot a province.
Yukon