jquery - $(...).intercode 不是函数 Phone.js
问题描述
我在我的 Wordpress 网站上使用的名为 Phone.js 的 JS 插件有问题。在我加载了我的 jQuery 之后,我已经包含了脚本。这是我用来触发添加电话字段的代码:
<code><script type="text/javascript">
jQuery(document).ready(function( $ ) {
$('.phone').intercode({
country: 'CA',
selectClass: 'countryCodeselect left',
intercodeFile: './js/countrycodes.json'
});
});
</script></code>
这是我在加载页面时收到的错误:
未捕获的类型错误:$(...).intercode 不是函数
这个问题发生在 phone.js 和 intlTelInput.min.js 中,所以它不是特定于一个插件的
任何建议都会很棒!
谢谢
解决方案
just to answer the question I figured out what was wrong with my integration.
The files were being loaded but in an incorrect order, which was preventing my script from using the loaded plugin functions.
I managed to fix the issue and now the phone field is displaying correctly.
Thanks
推荐阅读
- php - do_shortcode 不解析 acf 字段中的简码(wordpress)
- airflow - 包括天文学家气流的自定义代码
- java - ConfigServletWebServerApplicationContext: 嵌套异常是 java.lang.NoClassDefFoundError: jakarta/servlet/jsp/JspFactory 使用 Tomcat 10 - Spring
- scala - 我如何用许多护腕模拟方法?
- c++ - 架构设置错误的 C++ 未定义符号
- python - Starlette 会话状态清除
- acumatica - 如何使用合同 Web 服务从账单和调整附件中检索文件
- r - 如何使用 MICE 包进行多重插补后的预测
- ios - URL Scheme 选择错误的值
- android - 为 Android 上的应用禁用电池优化会消除对高优先级 FCM 通知的限制吗?