Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用jquery在nodeJs中隐藏元素_Javascript_Jquery_Node.js_Express - Fatal编程技术网

Javascript 使用jquery在nodeJs中隐藏元素

Javascript 使用jquery在nodeJs中隐藏元素,javascript,jquery,node.js,express,Javascript,Jquery,Node.js,Express,我是nodeJs的新手,一直在玩它。我也尝试过NodeJs express,一切似乎都很好。然而,我一直在尝试以这样一种方式使用Jquery,它可以处理客户端操作,如效果等,但即使在最基本的事情上似乎也失败了。因此,代码如下: <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js">

我是nodeJs的新手,一直在玩它。我也尝试过NodeJs express,一切似乎都很好。然而,我一直在尝试以这样一种方式使用Jquery,它可以处理客户端操作,如效果等,但即使在最基本的事情上似乎也失败了。因此,代码如下:

<!DOCTYPE html>
<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
    <script src="../public/javascripts/indexSite.js"></script>
    <title><%= title %></title>
    <link rel='stylesheet' href='/stylesheets/style.css'/>
</head>
<body>
<h1><%= title %></h1>

<p>Welcome to <%= title %></p>
</body>
</html>
$(document).ready(function(){
    $("body").hide();
});
这很简单,但我没能把尸体藏起来。。此外,在检查控制台和应用程序服务器时,请选择indexsite.js文件:

GET /public/javascripts/indexSite.js 404 5.113 ms - 856
GET /stylesheets/style.css 304 6.886 ms - -
GET / 304 1.753 ms - -
所以我相当惊讶

在indexSite.js上有一个404(未找到的错误)

替换:

<script src="../public/javascripts/indexSite.js"></script>

与:

<script src="/javascripts/indexSite.js"></script>


你在
GET/public/javascripts/indexSite.js 404 5.113 ms-856
上看到
404
了吗?很明显,我没有看到,完全没有看到为什么一切都这么简单。。然而,我似乎总是想念它。不管怎样,谢谢。不客气,不要犹豫,在答案旁边向上推箭头;-)