TypeError: $(…).intlTelInput is not a function
See original GitHub issueI’m trying to use intlTelInput for a HTML registration page but I am getting the following error:
Uncaught TypeError: $(...).intlTelInput is not a function
Here is the registration view code:
<html>
<head>
<!-- Page for customer registration and submit details to database to associate SSO with company etc -->
<link rel="stylesheet" type="text/css" href="views/register.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="../bower_components/intl-tel-input/build/css/intlTelInput.css">
<script src="../bower_components/intl-tel-input/build/js/intlTelInput.js"></script>
<script>
$("#phoneNumber").intlTelInput();
// get the country data from the plugin
var countryData = $.fn.intlTelInput.getCountryData(),
telInput = $("#phoneNumber"),
addressDropdown = $("#country");
// init plugin
telInput.intlTelInput({
utilsScript: "../bower_components/intl-tel-input/build/js/utils.js" // just for formatting/placeholders etc
});
// populate the country dropdown
$.each(countryData, function(i, country) {
addressDropdown.append($("<option></option>").attr("value", country.iso2).text(country.name));
});
// set it's initial value
var initialCountry = telInput.intlTelInput("getSelectedCountryData").iso2;
addressDropdown.val(initialCountry);
// listen to the telephone input for changes
telInput.on("countrychange", function(e, countryData) {
addressDropdown.val(countryData.iso2);
});
// listen to the address dropdown for changes
addressDropdown.change(function() {
telInput.intlTelInput("setCountry", $(this).val());
});
</script>
</head>
<form name="page1" id="page1" role="form">
<div id="createCasePage1" class="container-fluid">
<div class="col-md-6 col-xs-12">
<div class="form-group">
<label for="phoneNumber">Phone Number:</label>
<input type="tel" id="phoneNumber" name="phoneNumber" ng-model="createUserObj[0].phoneNumber" class="form-control" required>
</div>
</div>
<div class="col-md-6 col-xs-12">
<div class="form-group">
<label for="country">Country:</label>
<!--<input type="text" id="country" name="country" ng-model="createUserObj[0].country" class="form-control" placeholder="Country" required maxlength="100" /> -->
<select id="country" name="country" ng-model="createUserObj[0].country" class="form-control" required></select>
</div>
</div>
<!-- Check valid inputs and patterns then submit to controller -->
<button type="submit" id="register" class="btn btn-large" class="registerBtn" ng-click="page1.$valid && createUserFunc()">Register</button>
<br>
<br>
</div>
</form>
</html>
I think it’s an issue with jQuery and Angular but I’m not really sure.
Issue Analytics
- State:
- Created 6 years ago
- Comments:22 (4 by maintainers)
Top 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 - GitHub
When I try to view the page I am getting a console error 'Uncaught TypeError: window.intlTelInput is not a function'.
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 >Solved - intlTelInput is not a function - Therichpost
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 >How to add intlTelInput in Magento Checkout
Issue solved. I forgot window window.intlTelInput(input, { // any initialisation options go here });. I also had another error:.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed Solution: In intlTelInput.js replace .load(function() { … }); To .on(‘load’, function() { … });
I had this issue. Just wrap the entire input code within;