i_t*_*ope 0 jquery twitter-bootstrap
我是jQuery的新手,并且使用更简单的脚本创建了一个简单的index.html.但是,jQuery库似乎没有加载,因为在我的firebug控制台中我收到以下错误:
TypeError: $ is not a function
$(document).ready(function() {
Run Code Online (Sandbox Code Playgroud)
下面是我的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>
Run Code Online (Sandbox Code Playgroud)
这是jQuery脚本:
$(document).ready(function() {
alert("hello");
});
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏!
<script src="http//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
Run Code Online (Sandbox Code Playgroud)
应该:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
Run Code Online (Sandbox Code Playgroud)
此外,建议在<body>标记结束之前加载JavaScripts ,以提高页面加载速度.
另外:您的结束<body>标记应该是</body>(缺少正斜杠).
| 归档时间: |
|
| 查看次数: |
76 次 |
| 最近记录: |