JQuery 不适用于 Eclipse

丽兹

我是 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>

但是我在服务器上看不到结果。

JG73

确保reference path文件(src)正确并且您拥有permissions to read它。

试试这个,

  1. 创建了一个test.js文件,只有这行代码alert("this work!");
  2. 把它test.js放在你的文件夹里App,当你有你的时候jquery.js
  3. 在您的代码中进行引用 <script type="text/javascript" src="/app/test.js"></script>

如果你能看到alert("this work!")现在,你就知道你的参考是好的,如果你没有看到,你做错了什么。

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章