• Resolved ghadir29

    (@ghadir29)


    Hello. First, thanks for the great plugin.

    I need to choose only certain countries to display (or more specifically, remove some countries). In your faq, you have this:

    “Add only selected countries iso code from settings section. Contact >> CPF Settings. Example: us,in,ca,gb”

    Which I didn’t understand. Is it something I should do inside the tag? Like in here:
    [phonetext* phone-flag] -?

    Or in the ‘Additional Settings’? If it’s in the Additional Settings, what exactly should I write?

    Thank you.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter ghadir29

    (@ghadir29)

    Okay, I managed to resolve this by adding javascript (so this is for removing a country):

    <script>
    $(“li.country”).has(/*put-country-two-letter-selector-here, example:*/ “.br” /*for brazil*/).css(“display”, “none”);
    </script>

    More neatly for non-developers (put the two letter selector of required country instead of br):

    <script>
    $(“li.country”).has(“.br”).css(“display”, “none”);
    </script>

    Thank you anyway!

    • This reply was modified 5 years, 1 month ago by ghadir29.
    Thread Starter ghadir29

    (@ghadir29)

    Okay, turns out that the above solution works for desktop, but it is not working for mobile. Can I get some help as to why it doesn’t work on mobile? Any help is appreciated.

    Thread Starter ghadir29

    (@ghadir29)

    Here is why it wasn’t working for mobile: because the javascript I was applying was being applied on the container element on page load, but the container isn’t visible on page load. The solution was to put an ‘onlcik’ function on the flag, and then apply the code:

    $(“.flag-container”).on(“click”, function () {
    $(“.iti-mobile .intl-tel-input .country-list .country”).has(“.br”).css(“display”, “none”);
    });

    Okay so consider it solved ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to select certain countries only (or remove countries)’ is closed to new replies.