jQuery仍然有点新,所以我可能会犯一个基本错误。 我刚刚完成了jQuery的入门课程,现在正在尝试做一些我自己的基础工作,但碰到了轻微的障碍。 本质上,它似乎jQuery文件script.js没有得到正确调用。 当我跑它插入到stackoverflow它似乎工作正常。但是,当我在浏览器中拉取html文件时,它只显示文件中的html元素,而不是任何jQuery代码。jQuery不能在Eclipse中工作
任何帮助,将不胜感激!
\t $(document).ready(function() {
\t $("body").append("<p>I\'m a paragraph!</p>");
\t \t \t /* write 'Hello World! to the first div' */
\t \t \t $("#first").append('<h1> Hello World!</h1>');
\t \t \t //a clickable 'Hello World!' example
\t \t \t $("#link").click(function() {
\t \t \t \t $('#greeting').append("<h1>Hello Again!</h1>");
\t \t \t });
\t \t });
<!DOCTYPE html>
<html>
<head>
<title>Hello World - jQuery Style</title>
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<link rel="stylesheet" type="text/css" href="stylesheet.css"/>
</head>
<body>
\t <div id="first"></div>
\t <div id="second">
\t \t <a href="#" id="link">Click Me!</a> <br /> <span id="greeting"></span>
\t </div>
</body>
</html>
你有任何控制台错误? – D4V1D
@ D4V1D在Eclipse中没有任何类型的错误。 –