Generic Country & State Dropdown List – countries.js

Category: Form , Javascript | February 6, 2015
Author:
Views Total: 8,712
Official Page: Go to website
Last Update: February 6, 2015
License: MIT

Preview:

Generic Country & State Dropdown List – countries.js

Description:

A JavaScript library to create country & state dropdown lists containing all the country names and state names.

How to use it:

Load the countries.js JS library in your project.

<script src="countries.js"></script>

Create select list for country & state selection.

<select id="country" name="country"></select>
<select name="state" id="state"></select>

14 thoughts on “Generic Country & State Dropdown List – countries.js

  1. Maher Nabeel

    this is pretty awesome. I think you should include this snippet on How to use section:

    populateCountries(“country”);

    Reply
  2. Chris

    The only naming error i found so far is Romania is incorrectly spelled Romainia

    Reply
  3. Mastermind

    I can seem to get the value of the dropdown on submit. I’m sing php to post the selected country and state to database but value comes empty. Any help please?

    Reply
  4. AndyInLondon77

    You could try http://geodata.solutions – they just give you a bit of code to paste into your site and by the power of ajax it’s all done for you. There’s even lots of configuration options.

    Reply
  5. Mohit

    But I need City js file also which will include individual state city ,so could u plz help me?

    Reply
    1. AndyInLondon77

      Oh, I think what you mean is to just have the cities from one state in a dropdown. Is that what you want?

      Reply
  6. Mohit

    This is really awesome ,and it works very well in my website,but i want city js file also .

    Reply
    1. AndyInLondon77

      Are you saying that you’d like a city dropdown for a single country with the cities grouped by state (like you can group countries by continent?). I could look into this for you

      Reply
  7. Prabhu

    This is really awesome.But I want to load a particular country and particular state.So could u please help me.?

    Reply

Leave a Reply