国际电话号码输入问题

6
我正尝试在注册过程中实现"国际电话输入"。我有css文件:/css/intlTelInput.css,和js文件:/js/intlTelInput.js。这是HTML:
<div class="form-group" id="phone-group" style="display:none;">
    <label><%= l('Phone number') %></label>
    <input id="phone" name="phone" type="tel">
  </div>

<script src="/js/intlTelInput.js"></script> 
<link rel="stylesheet" href="/css/intlTelInput.css">

还有脚本功能:

var phone_intl = document.querySelector("#phone");
  window.intlTelInput(phone_intl, {
    utilsScript: "/js/utils.js"
  });

在这里输入图片描述

但它的显示效果与预期不符。我已经尝试了这个解决方案:https://intl-tel-input.com/。你有任何想法可能是什么问题,或者你有另一个想法吗?谢谢!

1个回答

0

试试这个

const input = document.querySelector("#phone");
intlTelInput(input, {
    // any initialisation options go here
    utilsScript: /js/intltelinputNew/utils.js /* path here */
});

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接