Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Intl Tel Input Uncaught TypeError: Cannot read property 'getAttribute' of null at new Iti (intlTelInput.js:146) at intlTelInput.js:1282

Tags:

javascript

<link rel="stylesheet" href="styles/intlTelInput.scss">
<input type="tel" required id="#consultPhone">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/15.0.0/js/intlTelInput.js"></script>
  <script src="scripts/scripts.js"></script>
  <script type="text/javascript">
    var consultInput = document.querySelector('#consultPhone');
    var iti = window.intlTelInput(consultInput, {
      separateDialCode:true,
      utilsScript: "https://cdn.jsdelivr.net/npm/[email protected]/build/js/utils.js",
    });
    window.iti = iti;
  </script>

So this is my code, when I open the page the input is empty and i get this error: Uncaught TypeError: Cannot read property 'getAttribute' of null at new Iti (intlTelInput.js:146 at intlTelInput.js:1282 at index.html:973

like image 337
Vadim Surugiu Avatar asked Oct 26 '25 06:10

Vadim Surugiu


1 Answers

Basically I am stupid, forgot to remove the hashtag from the id ๐Ÿ˜…

like image 154
Vadim Surugiu Avatar answered Oct 29 '25 09:10

Vadim Surugiu