到官网下载jQuery文件,可是运行不了,为什么?

<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() { //显示错误
$("button").click(function() {
$("p").hide();
});
});
</script>
</head>

<body>

<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button type="button">Click me</button>

</body>
</html>

阅读 3.7k
1 个回答

虽然没用过sublime, 但是它只是个编辑器啊, 他的jquery plugin应该只是有语法提示功能吧, 你要运行js还是要在解释器里运行的(比如浏览器), 这时候你需要jquery.js

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题