Skip to main content

Hi,


I am using the country drop down with a geo script to auto populate the country field.

But I would like it to show +34 instead of Spain, +44 instead of United Kingdom.


I seen an old post with a script that replaced the countries with 3 letters but the script doesn’t seem to work anymore.


Does any one know of a script to change the Drop Down Country List to their Dial Prefix’s or similar and I can customise it?


Or alternatively is there a script for a “custom drop down” that can wil list all of the international dial codes?


I can’t seem to find anything that is working.


Thank you.

Or alternatively a script that will fill in the International dialling code into a field rather than a drop down box based on the geo location.


Thank you.


Hi @SergeEnergy,


You can always create your own drop-down list and add as many country codes as you need to it, in the order you want them.


As far as a script that would fill in the international dialing code, it would have to be custom coded and you would need to use a 3rd party API that would tell you the country of the visitor.


Keep in mind that these 3rd parties are not always 100% accurate but on the country level can be pretty close. As long as your visitors are not behind a VPN.


Best,

Hristian


Hey Hristian,


Thank you for the reply.


Yes, but there are too many country codes and I find it hard to believe that no one hasn’t already done this and I do not want to manually input all of these country codes haha. (I have actually seen an unbounce page that had this script/function about 4-5 years ago)


I already have a geo location script running that auto populates the country, so that is not an issue.


Now all I need is a script that changes the values of a drop down, i.e; United Kingdom to show +44, basically a replace script that only effect a from field. This way the geo location will set it to the country, and the replacement script will change the country to a dial code. viola!


Here is the change script I found, but it doesn’t seem to work anymore and I am not sure why.




Thank you.


Do you have jQuery running on the page?


I believe so yes, the geo location script uses jQuery.


I am talking about pelowski s comment in that thread, changing the options to 3 letter values.


This is in above my geo location script:



Which I assume will apply jQuery for my whole page?


Thank you.


script src="//ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type=“text/javascript”></script


Hi @SergeEnergy,


jQuery needs to load first before any other scripts that might be using it. That’s why, usually, jQuery is loaded in the <HEAD> of the page, while all other scripts are loaded <BEFORE BODY END> tag.


Look at your browser’s console and will most likely tell you if there is an issue with the placement. We can’t help you troubleshoot an issue if we can’t see the actual page.


Last but not least, the changed values of a dropdown would be visible only in the leads list once a form has been submitted. It won’t change what’s shown on the screen/dropdown.


Best,

Hristian


Hi Hristian,


That makes sense why nothing is being changed then, I am looking on the preview/live site, expecting the changes there.


My jQuery is also definitely working too, but this script is not what I need.


I need a script that can fill in the dial codes on the drop down rather than me manually putting them all in. Ideally auto populated by Geo Location (IP), or I could even just make it a text input field and have a script auto fill a value dependent on the Geo Location. i,e; if it’s a Spanish IP, fill field “prefix” with +34, if United Kingdom, fill with +44, etc.


Are you aware of any scripts that do this or similar? I know one must exist as I “used” it in a landing page many, many years ago, unfortunately I no longer have access to it and I never put the script in myself.


Thanks again for your help.


 


Hey @SergeEnergy!

 

🚀 We have a brand new, complete solution for adding Country Codes and Flags to Unbounce!

🆓 FREE Version:


💎 PRO Powerful Version:
👉 https://www.grooic.com/cfu-unbounce

 

👀 Check Out the Live Preview Here:

🌐 https://www.grooic.com/cfu-preview/

 

🤝 If you have any questions or need support, feel free to reach out to us on WhatsApp: 💬 +1 917 900 3111

Thanks,


Reply