Generic Country & State Dropdown List – countries.js

Category: Form , Javascript | February 6, 2015
Views Total:80,886 views
Official Page:Go to website
Last Update:February 6, 2015


Generic Country & State Dropdown List – countries.js


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>

You Might Be Interested In:

25 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:


  2. Chris

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

  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?

  4. AndyInLondon77

    You could try – 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.

    1. Azim Khan

      I used it for while integrating was working fine. suddenly stopped not getting any response in api call.
      not good for production.

  5. Mohit

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

    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?

  6. Mohit

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

    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

  7. Prabhu

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

  8. Nemanja Boskovic

    Yugoslavia fell apart in 2000. please update the countries list…

  9. lksjdkf sflkjsdkfj sfkjsldfk

    Country dropdown working, but State and City values not working.

  10. sathya

    HI, i have tried to use it, but its not working for me.can you help on this

  11. Ameya K

    this code is awesome..!
    Thanks a lot!
    Yet, It would have been much more helpful if could get an additional list of CITIES..

    Thank you !

  12. luckw

    There is any way to add by class and same class use multiple counties and state select?

  13. dhanesha

    how to use this on update page of php? country and state selected as per user’s country and state which is store on database

  14. Amanda Snyder

    Thank you so much for this script, you’ve helped me a lot and I’m grateful to you.


Leave a Reply