【问题标题】:Uncaught SyntaxError: Invalid regular expression [intlTelInput]未捕获的 SyntaxError:无效的正则表达式 [intlTelInput]
【发布时间】:2022-05-14 15:00:45
【问题描述】:

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

     $(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)

【问题讨论】:

标签: c# asp.net-core .net-core


【解决方案1】:

这个问题是由于脚本文件的字符集来修复它你可以在调用脚本文件时使用下面的代码。

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

【讨论】:

    猜你喜欢
    • 2017-02-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-12
    • 1970-01-01
    • 1970-01-01
    • 2020-05-01
    相关资源
    最近更新 更多