intlTelInput is not a function

See original GitHub issue

Hello, I know this issue has been reported many times but none of the answers have been able to fix my problem.

Steps to reproduce

Same as the Github ones, both css and js imports (that is the right path): <link rel="stylesheet" href="./node_modules/intl-tel-input/src/css/intlTelInput.css"> <script src="./node_modules/intl-tel-input/src/js/utils.js"></script> My input is generated dynamically with a ‘tel’ type I then check the type and execute the following code: if (columnData.forminfo.fields[u].inputtype === "tel") { var input = $("#"+columnData.forminfo.fields[u].inputid); window.intlTelInput(input); } But I also tried this (with the utils import too): var input = document.querySelector("#"+columnData.forminfo.fields[u].inputid); var iti = intlTelInput(input, { utilsScript: "https://cdn.jsdelivr.net/npm/intl-tel-input@16.0.3/build/js/utils.js", }); }

Expected behaviour

I should have had my input created with the flag version.

Actual behaviour

I get an error: ‘intlTelInput is not a function’.

Initialisation options

I put my code above.

If I don’t use the window. in the first code, I get a ‘intlTelInput is not defined’ if it can help.

Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:19 (6 by maintainers)

github_iconTop GitHub Comments

11reactions
jackocnrcommented, Nov 5, 2019

I’m sorry but if you’re having problems with basic JavaScript operations like selecting an element, then I don’t have time to provide support for that - I would recommend you ask on StackOverflow. best of luck.

0reactions
nmg196commented, Aug 24, 2022

The error in my case was that I’d copied the wrong JavaScript files from the release zip file into my project - I’d copied from the src folder instead of the build folder.

Check that the intlTelInput.js linked to from your page starts with a header like this, rather than pure JS code:

/*
 * International Telephone Input v17.0.18
 * https://github.com/jackocnr/intl-tel-input.git
 * Licensed under the MIT license
 */

Even the minified version has this header. Hope this helps someone.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught TypeError: jQuery(...).intlTelInput is not a function
I am getting the below error in Google Chrome while at the 3rd step of an appointment process. Uncaught TypeError: jQuery(...).intlTelInput is ......
Read more >
window.intlTelInput is not a function · Issue #1207
Hello, I am following the instructions on getting started without a bundler and I am unable to get the example to work locally....
Read more >
Solved - intlTelInput is not a function
intlTelInput is not a function ; ERROR TypeError: ctx.telInputObject is not a function. Here is the proper tutorial to add input type phone ......
Read more >
Uncaught TypeError: jQuery(…).intlTelInput is not a function
intlTelInput is not a function. javascriptjquerytypeerror. I am getting the below error in Google Chrome while at the 3rd step of an appointment...
Read more >
Some JS Problems and other problems
1) Running into some .js file problems for intlTelInput.min.js & simple-job-board-public.js… Jquery not defined and telInput.intlTelInput is not a function ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found