Do you know any opensource JQuery dropdown menu fo

2019-02-01 06:40发布

问题:

I need to do a dropdown menu for entering telephone numbers. I want to do something similar as google does in his registration form. Something like this:

Do you know any opensource dropdown menu for telephone prefix?

I have looking in google and the most similar thing I have found is this menu. I can modify it to do what I want but it will take time and I think maybe someone has already did something similar.

NOTE: The link I am sharing contains only countries and flags. I am looking for a full dropdown containing flags, country names, country names in original language, ability to add a country first ignoring alphabetical order and international phone prefixes.

回答1:

I also needed this, so I built it.

Here is a live demo.

It currently has the following features:

  • In the country dropdown you can navigate by typing, or using the up/down keys
  • Selecting a country updates the dial code of the entered number
  • Typing a different dial code automatically updates the displayed flag
  • Option to specify "preferred countries" (which appear at the top of the list)

I built it out of the following open source projects:

  • Flag images and CSS from https://github.com/lafeber/world-flags-sprite
  • Country data from https://github.com/mledoze/countries
  • Formatting and validation from the wonderful libphonenumber


回答2:

Well, you need a database which contains all the details of the phone-numbers, then you need to query the database through Ajax, return the results via Ajax too, and display it. After getting the results, you can create a div or p element of your own, populate them with the incoming data, and display it. if you don't want to do that, use jQuery UI Autocomplete.