【问题标题】:Adding Client-Side jQuery Support添加客户端 jQuery 支持
【发布时间】:2015-04-08 13:41:26
【问题描述】:

如何将客户端 jQuery 支持添加到程序中?我想要 开始在我的 Web 应用程序中使用 jQuery,但在此之前, 我需要添加代码以在我的应用程序中包含 jQuery。

我需要在应用中添加什么代码以及添加到哪里?

我有以下包含文件的目录:

路由/index.js

views/layout.jade

views/index.jade

views/notes.jade

views/edit.jade

views/updated.jade

bin/www

【问题讨论】:

    标签: javascript jquery node.js express pug


    【解决方案1】:

    您可以在 layout.jade 中包含 Google Loader

    <script src="https://www.google.com/jsapi"></script>
    <script>
            google.load("jquery", "2.1");
            google.load("jqueryui", "1.11");
            google.setOnLoadCallback(function() {
                    //... your Code here
            }
    </script>
    

    【讨论】:

      【解决方案2】:

      试试这个

      script(type='text/javascript' src='http://code.jquery.com/jquery.min.js')
      

      【讨论】:

      • 翡翠怎么写?我没有使用 HTML 语法。我收到一条错误消息,说 Unexpected Identifier
      • 我已经编辑了我的答案,试试看,告诉我它是否有效。
      猜你喜欢
      • 1970-01-01
      • 2018-02-10
      • 1970-01-01
      • 1970-01-01
      • 2020-08-11
      • 2023-02-04
      • 2017-01-08
      • 2015-11-02
      • 1970-01-01
      相关资源
      最近更新 更多