0

I am facing an issue in intl-tel-input jquery Plugin When I select Canada on my edit page and save it and when refresh the page it shows US flag I It is happening because both USA and Canada has same iso2 code +1 I have read the whole docs but find nothing to fix this can any one help me in this regard how to fix this issue

steel
  • 11,883
  • 7
  • 72
  • 109

1 Answers1

1

https://github.com/Bluefieldscom/intl-tel-input has lots of public methods and configuration options you can use to help solve this issue. If this phone number is used in conjunction with an address (and "CA" is the country) you can use:

$("#mobile-number").intlTelInput(); // initialization
if($("#mailing-address-country-code").val()==="ca"){
    $("#mobile-number").intlTelInput("selectCountry", "ca"); // public method
}

otherwise if your code is being executed in an environment which deals primarily with Canadian numbers you can configure it so:

$("#mobile-number").intlTelInput({defaultCountry: "ca"}); // initialization with configuration option
BoatCode
  • 570
  • 5
  • 14