这是我第一次尝试使用jQuery和我试图当文档准备添加事件之前,但每次它说:
“$使用之前定义“。
我不知道如何解决它。我在网上尝试了不同的解决方案,但找不到任何解决方案。真的不知道我做错了什么。
我引用的HTML文件JS文件这样
<!DOCTYPE html>
<html>
<head>
<title>Experimenting with Javascript</title>
<script type="text/javascript" src="script.js"></script>
<link type="text/css" rel="stylesheet" href="main.css" />
</head>
,这是我的脚本
$(document).ready(function() {
"use strict";
$('div').mouseenter(function() {
$(this).animate({
height: '+=10px'
});
});
});
你需要在你的页面使用它[包括jQuery库](http://learn.jquery.com/about-jquery/how-jquery-works/)! – Bergi 2014-11-05 19:13:06
你在哪里添加jQuery? – 2014-11-05 19:13:32
如果你甚至不知道如何使用库,我会建议不要使用'“use strict”;',如果你没有经验,可能会导致问题(参见[this](https:// bugzilla)。 mozilla.org/show_bug.cgi?id=579119),甚至亚马逊也搞砸了)。 – blex 2014-11-05 19:18:28