Streaming live at 10am (PST)

Generate country code select field

Hey guys,

I have a form with a selec fields and input field: Country Code + Phone number.
How do I make the country code field automatically select the right country code based on ip address and in case it doesn’t work let people select it manually.

Much appreciate your help!

You would need to use a GEO IP library and then use custom code. You should probably post this as a freelance request if code is not your thing. Take a look at

Hi there!

IP geolocation service is a great solution for you, for example, Geo Targetly.

It can identify visitors’ locations by IP using large GeoIP database.

Particularly, GeoLocation API offers the function that autofill form elements or auto-select drop downs using IP geolocation data. In your case, country code could be selected automatically.

With GeoLocation API, no code is necessary. You could just drag and drop JavaScript they provided.

Hope it helps!

Hi, did you ever find a solution for this? Thanks a lot

Hey, did you search for it on codepen, maybe you could find it there?

Thanks, will have a search on there.