我已经尝试了一切来使以下代码正常工作,但我似乎无法正确加载jquery。我尝试从项目中的文件夹和使用 URL 进行安装。
这是我的代码片段,其中包括我用来加载JQuery库的不同方法。
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta name="" content="">
<title>DynamicPulldown</title>
<!-- <script id="javascript" src="http://localhost:81/js/jquery-
3.2.1.min.js"></script>-->
<!-- <script id="javascript" src="http://localhost:81/js/jquery-
3.2.1.min.js"></script>-->
<script src="/js/jquery-3.2.1.min.js"></script>
<script>
$(document).ready(function(){
$("p").click(function(){
$(this).hide();
});
</script>
</head>
<body>
<div>
<p>If you click on me, I will disappear.</p>
<p>Click me away!</p>
<p>Click me too!</p>
</div>
</body>
</html>
我已将我的索引.html文件放在以下文件夹 C:\xampp\htdocs 中,并将 jquery-3.2.1.min.js 文件放在以下文件夹 C:\xampp\htdocs\js 中
我在浏览器中查看页面的网址 http://localhost:81/index.html。
谢谢
戴夫
替换此代码
<script>
$(document).ready(function(){
$("p").click(function(){
$(this).hide();
});
});
</script>
Please add this )} at the end of the code.
$(document).ready(function(){
$("p").click(function(){
$(this).hide();
)};
});
你忘了 2 个括号!做 }( 在最后!