【问题标题】:Include jQuery SDK in my project [duplicate]在我的项目中包含 jQuery SDK [重复]
【发布时间】:2013-06-29 12:03:32
【问题描述】:

我在 Mac 上使用 Sublime Text 2 进行开发,但我不确定如何在我的项目中包含 jQuery SDK。我已经下载了 SDK。

【问题讨论】:

    标签: javascript jquery


    【解决方案1】:

    要包含 jQuery 或 any 其他外部 JS 资源需要使用<script> 标签,例如:

    index.html

    <html>
    <head>
      <title>My first jQuery page</title>
      <!--script src="/js/jquery.js" type="text/javascript"></script-->
      <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js" type="text/javascript"></script>
      <script type="text/javascript">
         $(function() {
           $("#test").html("It works!");
         });
      </script>
    </head>
    <body>
      <div id='test'></div>
    </body>
    </html>
    

    注释掉的部分是本地存储的 jquery.js

    【讨论】:

    • 嗨 mishik,你能告诉我 jquery.js 文件的位置吗?我在 jquerysdk->repository->script 中搜索。但是,我找不到。
    • @Karthick - 您的网页可以直接从 Google 的 CDN 或 jQuery 网站包含 jquery.js,但如果您想要直接在项目中的本地副本,您可以从 jQuery's website 下载 JS -按下大的“下载 jQuery”按钮,然后选择你想要的版本。
    【解决方案2】:

    http://jquery.com/ 下载 jquery.js 并将这一行添加到您的 html 文件中 &lt;script src="path_to_the_file_you_downloaded" type="text/javascript"&gt;&lt;/script&gt;

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-06-18
      • 1970-01-01
      • 2018-08-28
      • 2013-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-25
      相关资源
      最近更新 更多