未捕获的语法错误:正则表达式[intlTelInput]无效



我正在尝试在Asp.net core 6.0 razor页面中使用intl tel输入这是我的脚本

$(document).ready(function(){
$('#tbxPhone').intlTelInput();
});

但给出错误

控制台错误;

intlTelInput.js:10 Uncaught SyntaxError: Invalid regular expression: /^[a-zA-ZÀ-ÿ ]$/: Range out of order in character class
jquery-3.1.1.min.js:2 jQuery.Deferred exception: $(...).intlTelInput is not a function TypeError: $(...).intlTelInput is not a function
at HTMLDocument.<anonymous> (https://localhost:7283/SignUp:99:28)
at j (https://localhost:7283/assets/js/jquery-3.1.1.min.js:2:29948)
at k (https://localhost:7283/assets/js/jquery-3.1.1.min.js:2:30262) undefined
Uncaught TypeError: $(...).intlTelInput is not a function
at HTMLDocument.<anonymous> (SignUp:99:28)
at j (jquery-3.1.1.min.js:2:29948)
at k (jquery-3.1.1.min.js:2:30262)

此问题是由于脚本文件的字符集造成的。为了解决此问题,您可以在调用脚本文件时使用以下代码。

<script src="intlTelInput.min.js" charset="utf-8"></script>

最新更新