首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我正在尝试使用js脚本,但它显示了这个错误--未定义的ReferenceError: jQuery未定义

我正在尝试使用js脚本,但它显示了这个错误--未定义的ReferenceError: jQuery未定义
EN

Stack Overflow用户
提问于 2021-08-11 12:16:52
回答 2查看 449关注 0票数 0

实际上,我使用了一个模板,它包含了很多页面,所以我想使用其中的一个模板,所以我想我做了所有正确的事情,但是它在控制台未定义时显示了这个错误: jQuery没有定义--这是我唯一的html脚本

代码语言:javascript
复制
<script src="assets/js/pages/custom/wizard/wizard-1.js"></script>

我经常检查路径,这是一条正确的路径,我不知道在这些错误中给你们提供什么,所以这是我的index.html

代码语言:javascript
复制
<!doctype html>
<html lang="en">
<meta charset="utf-8">
<title>Gestion Commerciale</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/x-icon" href="./assets/media/svg/illustrations/logo.png">
<link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700|Roboto:300,400,500,600,700"
  rel="stylesheet">
<link href="assets/css/pages/wizard/wizard-1.css" rel="stylesheet" type="text/css" />
<!-- Splash Screen | Appears during application initialization proccess -->
<style>
  body {
    margin: 0;
    padding: 0;
  }

  #splash-screen {
    position: absolute;
    z-index: 1000;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    background-color: #f2f3f8;
  }

  #splash-screen img {
    margin-left: calc(100vw - 100%);
    margin-bottom: 30px;
  }

  #splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
  }

  .splash-spinner {
    animation: rotate 2s linear infinite;
    margin-left: calc(100vw - 100%);
    width: 50px;
    height: 50px;
  }

  .splash-spinner .path {
    stroke: #5d78ff;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
  }

  @keyframes rotate {
    100% {
      transform: rotate(360deg);
    }
  }

  @keyframes dash {
    0% {
      stroke-dasharray: 1, 150;
      stroke-dashoffset: 0;
    }

    50% {
      stroke-dasharray: 90, 150;
      stroke-dashoffset: -35;
    }

    100% {
      stroke-dasharray: 90, 150;
      stroke-dashoffset: -124;
    }
  }
</style>
</head>

<body root id="kt_body">
  <div id="splash-screen">
    <img src="./assets/media/svg/illustrations/logo.png" alt="Gestion-Commerciale-Logo" />
    <svg class="splash-spinner" viewBox="0 0 50 50">
      <circle class="path" cx="25" cy="25" r="20" fill="none" stroke-width="5"></circle>
    </svg>
  </div>
</body>
<script src="assets/js/pages/custom/wizard/wizard-1.js"></script>
</html>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2021-08-11 12:35:53

向导-1.js可能取决于jQuery。如果是这样,则需要在jQuery向导-1.js之前加载

可以这样做:

代码语言:javascript
复制
<body root id="kt_body">
  <div id="splash-screen">
    <img src="./assets/media/svg/illustrations/logo.png" alt="Gestion-Commerciale-Logo" />
    <svg class="splash-spinner" viewBox="0 0 50 50">
      <circle class="path" cx="25" cy="25" r="20" fill="none" stroke-width="5"></circle>
    </svg>
  </div>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  <script src="assets/js/pages/custom/wizard/wizard-1.js"></script>
</body>

另一个技巧是,在body标记的底部添加脚本标记。

票数 2
EN

Stack Overflow用户

发布于 2021-08-11 12:23:32

我想您的库需要jquery,但是您没有将它包含在Html中,尝试添加以下内容:

代码语言:javascript
复制
<script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68741847

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档