我是 jQuery 新手,并且使用更简单的脚本创建了一个简单的 index.html。但是,jQuery 库似乎没有加载,因为在我的 firebug 控制台中我收到以下错误:
TypeError: $ is not a function
$(document).ready(function() {
下面是我的 index.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Online Calorie Tracker and Analyzer</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css">
<script src="http//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="initialize.js"></script>
</head>
<body>
<div class="container">
<h1>Calorie Tracker and Analyzer</h1>
<div class="navbar">
<div class="navbar-inner">
<div class="container">
<ul class="nav">
<li class="active"><a href="index.html">Home</a></li>
<li><a href="#">Track Food</a></li>
<li><a href="#">Analyze Food</a></li>
</ul>
</div>
</div>
</div>
<div class="hero-unit">
<h1>A healthy you begins with tracking and analysis</h1>
<p>10 out of 10 doctors agree. Losing weight is healthy. With our online calorie tracker and analyzer, the power is in your hands!</p>
<button class="btn btn-danger" id="btn1">Get Started</button>
</div>
</div>
<body>
<html>
这是 jQuery 脚本:
$(document).ready(function() {
alert("hello");
});
任何帮助表示赞赏!