Closed vickykrbu closed 5 years ago
If you can find the minimal set of code that reproduces the problem and put that in a CodePen, then I'd be happy to take a look. Here is an example pen with the plugin up and running - feel free to fork this if it helps.
Hi Jackocnr,
Thank you for the quick response. I have gone through the pen link and found like here
var input = document.querySelector("#phone");
above code is used direct in script without under any load functions but in my case when i used the same in outside input value is null in my application. But if i put the same under window.load function then this code is working. Now one more thing i found here like i have checked the example demo page where this code is just put globally. but when i am trying to put the same in my application getting null value for the input variable. I really don't understand why. Currently i am trying to implement it for my MVC application.
Please suggest.
Hi there, I'm glad you solved your first problem.
Re: your second problem, I'm afraid I have the same answer: please create a codepen to show the problem and then I can take a look :)
Hi Jackocnr, Finally i was able to create the code pen link is here As i discussed above getting same error here. IntlTelInput is not a function.
You have switched from the pure JS syntax to the jQuery syntax. See the readme section on getSelectedCountryData
for the pure JS syntax.
Steps to reproduce
Expected behaviour
I should able to get the country dial code based on the current selected flag
Actual behaviour
When i use this code:
$("#phone").intlTelInput("getSelectedCountryData").dialCode;
inside document.ready or document.load function getting intlTelInput is not a function errorInitialisation options
First of all i just wanted to mentioned here whatever example i found in the github or stackoverflow no where it is mention like in which event we have to initialize the IntlTelInput function. But some how i managed to do that. Below is my complete code ``
Till above code i used and i am able to get the current country flag selected based on the current user location on load. Now when user enter some number after that i need here once user finished entering number then i should get the current country dial code to utilized that dial code for some purpose. But when i used the code above "countrychange" event but this event is not firing. If i am trying to use this event inside jquery.load function then getting IntlTelInput is not a function.
Please review my above code and suggest to access country dial code.