我是 JQuery 的新手,正在使用 Eclipse 开发一个 mavenized 动态 Web 应用程序。我下载了 JQuery 并将文件夹放在 webcontent 下并用src
标签引用它。
下面是代码片段:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<script type="text/javascript" src="/app/jquery-3.2.1.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#hh").hide;
alert("OK");
});
</script>
</head>
<body>
<input type="button" id="hh" value="here">
</body>
</html>
但是我在服务器上看不到结果。
确保reference path
文件(src)
正确并且您拥有permissions to read
它。
试试这个,
test.js
文件,只有这行代码alert("this work!");
test.js
放在你的文件夹里App
,当你有你的时候jquery.js
<script type="text/javascript" src="/app/test.js"></script>
如果你能看到alert("this work!")
现在,你就知道你的参考是好的,如果你没有看到,你做错了什么。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句