【问题标题】:jQuery is not defined (within jQuery UI)未定义 jQuery(在 jQuery UI 中)
【发布时间】:2018-01-26 05:26:30
【问题描述】:

我已经下载了 jQuery 3.2.1 和 jQuery UI 1.12.1,我正在加载它们:

<script src="js/jquery-3.2.1.min.js" type="text/javascript"></script>
<script src="js/jquery-ui.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="css/style.css">

我收到一个未捕获的引用错误:

Uncaught ReferenceError: jQuery is not defined(匿名函数) @ jquery-ui.js:14(匿名函数)@jquery-ui.js:16 index.html:165 未捕获的类型错误:table.insertRow 不是 functionObject.keys.forEach.key@index.html:165loadResultsIn@ index.html:164loadhistory@index.html:186onload@index.html:12

我正在尝试将它与 Electron 一起使用。不太确定这里发生了什么。也尝试过从 CDN 加载并遇到同样的问题

【问题讨论】:

  • 可能是您的脚本的位置。您的错误不是指 index.html 中的错误吗?也许你在哪里尝试使用 jQuery?
  • 要么使用最新的 jQuery-ui 库,要么将主 jQuery 库降级为旧库以支持 jQuery 语法
  • @lscmaro 我还没有使用 jQuery,只是链接到它!
  • @AlivetoDie 1.12.1 是 jQuery UI 的最新版本。我试过 jQuery 1 - 3 都导致同样的问题

标签: jquery jquery-ui


【解决方案1】:

在这里找到解决方案: Electron: jQuery is not defined

<!-- Insert this line above script imports  -->
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>

<!-- normal script imports etc  -->
<script src="scripts/jquery.min.js"></script>    
<script src="scripts/vendor.js"></script>    

<!-- Insert this line after script imports -->
<script>if (window.module) module = window.module;</script>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-08-21
    • 1970-01-01
    • 1970-01-01
    • 2017-05-23
    • 1970-01-01
    • 1970-01-01
    • 2014-08-07
    相关资源
    最近更新 更多