所以我正在学习开发网站。我很新,所以我尝试使用Jquery。我似乎无法让它在我的网站上做某事。
我已经测试了是否将Jquery加载了。我测试了代码:
<!doctype html>
<html>
<head>
<title>Dont kown yet</title>
<link rel="stylesheet" href="cascadingStyleSheets/index.css">
<script scr="library/javaScriptLibrary/jquery-3.4.1.js"></script>
</head>
<body>
<div id="navigationContainer">
<div id="navigationButton">
<button id="navigationButtonButton"></button>
</div>
<div id="navigationMenu">
<ul>
<li class="navigationLink"><a class="navigationLinkText" href="">Home</a></li>
<li class="navigationLink"><a class="navigationLinkText" href="">Canada 2018</a></li>
<li class="navigationLink"><a class="navigationLinkText" href="">Exchange Student</a></li>
</ul>
</div>
</div>
<script>
$(Document).ready(function(){
$('.navigationLink').hide();
$('#navigationMenu').hide();
});
</script>
</body>
</html>
更新后的代码似乎仍然无法正常工作
<!doctype html>
<html>
<head>
<title>Dont kown yet</title>
<link rel="stylesheet" href="cascadingStyleSheets/index.css">
<script scr="library/javaScriptLibrary/jquery-3.4.1.js"></script>
</head>
<body>
<div id="navigationContainer">
<div id="navigationButton">
<button id="navigationButtonButton"></button>
</div>
<div id="navigationMenu">
<ul>
<li class="navigationLink"><a class="navigationLinkText" href="">Home</a></li>
<li class="navigationLink"><a class="navigationLinkText" href="">Canada 2018</a></li>
<li class="navigationLink"><a class="navigationLinkText" href="">Exchange Student</a></li>
</ul>
</div>
</div>
<script>
$('.navigationLink').hide();
$('#navigationMenu').hide();
</script>
</body>
</html>
我期望会发生什么,但什么也没发生。当然,它应该对元素隐藏。