Closed NickSutton closed 3 months ago
I assume you mean countryOrder: ['ca']
with the array brackets?
I tried it here: https://codepen.io/jackocnr/pen/xxNrjRM?editors=0010
And it seems to work fine. Can you reproduce the issue in a codepen? You can fork that one if it helps.
Hmmm, thanks.
I'm passing in the country code as a variable:
const countryCode = 'gb'
const iti = window.intlTelInput(input, {
showSelectedDialCode: true,
separateDialCode: true,
strictMode: true,
initialCountry: countryCode,
countryOrder: [countryCode],
nationalMode: true
// No utils scripts as I'm loading intlTelInputWithUtils.min.js
});
But have forked your codepen (https://codepen.io/TheMiddle361/pen/ZENyVLx), but can't reproduce the issue... Here's what I'm seeing:
https://github.com/jackocnr/intl-tel-input/assets/24848258/5c56993a-622a-4f98-9fb6-6c2252d77b1c
Fixed. It was an issue with initialising the iti variable somewhere. changed to const newIti
and it's working the same as the Codepen now.
Plugin version
v23.0.10
Steps to reproduce
Expected behaviour
Any countries specified in the 'countryOrder' option should be displayed at the top of the list
Actual behaviour
The country list is returned to alphabetical order
Initialisation options
List any options you're using e.g. utilsScript or onlyCountries