在NodeJS Express应用程序的DOM操作中使用jQuery

在NodeJS Express应用程序的DOM操作中使用jQuery,jquery,node.js,twitter-bootstrap,Jquery,Node.js,Twitter Bootstrap,我正在开发第一个nodejs应用程序,需要使用jquery进行DOM操作。我通过npm安装了bootstrap,我的浏览器报告bootstrap.min.js和bootstrap.min.css都已成功加载 我在我的项目目录中执行npmibootstrap。并使用app.use(express.static(uu dirname+'/node_modules/bootstrap/dist')将引导加载到我的js文件中 我在用于显示应用程序的Handlebar脚本中包括引导js和css。css生效

我正在开发第一个nodejs应用程序,需要使用jquery进行DOM操作。我通过npm安装了bootstrap,我的浏览器报告bootstrap.min.js和bootstrap.min.css都已成功加载

我在我的项目目录中执行
npmibootstrap
。并使用
app.use(express.static(uu dirname+'/node_modules/bootstrap/dist')将引导加载到我的js文件中

我在用于显示应用程序的Handlebar脚本中包括引导js和css。css生效并为我的应用程序设置样式,但我无法正确获取jquery代码。下面的代码是我的车把文件的内容:

<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>Page Title</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <script language="javascript" src="js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="css/bootstrap.min.css"/>
</head>
<body>
    {{ my-content-outputing-here }}
</body>
</html>

<script type="text/javascript">
    $(body).hide();
</script>

<script>
    jquery(document).click(
        function(){
            alert( 'success' );
        }
    );
</script>

您尚未在需要包含的标题部分添加jQuery脚本

<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>Page Title</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <link rel="stylesheet" href="css/bootstrap.min.css"/>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script language="javascript" src="js/bootstrap.min.js"></script>
</head>

非常感谢。但是,我希望在本地使用jquery,而不是使用CDN。我想bootstrap已经安装了jquery,可以在本地使用吗?我可以证实。我粘贴了引导模块的打印输出,以确认jquery@siskojQuery不附带引导。您需要通过
npmijquery
或通过CDN安装它。
<head>
    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>Page Title</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <link rel="stylesheet" href="css/bootstrap.min.css"/>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script language="javascript" src="js/bootstrap.min.js"></script>
</head>
$(document).ready(function() {

    $(document).click(
        function() {
            alert( 'success' );
        }
    );

});