javascript不是';t在html上工作

javascript不是';t在html上工作,javascript,html,Javascript,Html,我对html和javascript都是新手 我从codecademy复制了这些代码,但是它们工作得不好。我希望有人能向我解释为什么javascript不能在我的html中工作。非常感谢你 index.html <html> <head> <link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet"> <link hr

我对html和javascript都是新手

我从codecademy复制了这些代码,但是它们工作得不好。我希望有人能向我解释为什么javascript不能在我的html中工作。非常感谢你

index.html

<html>
<head>

<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400;300' rel='stylesheet' type='text/css'>
<link href='style.css' rel='stylesheet'>

</head>
<body>
<div class="menu">

  <!-- Menu icon -->
  <div class="icon-close">
    <img src="http://s3.amazonaws.com/codecademy-content/courses/ltp2/img/uber/close.png">
  </div>

  <!-- Menu -->
  <ul>
    <li><a href="#">About</a></li>
    <li><a href="#">Blog</a></li>
    <li><a href="#">Help</a></li>
    <li><a href="#">Contact</a></li>
  </ul>
</div>

<!-- Main body -->
<div class="jumbotron">
  <div class="icon-menu">
    <i class="fa fa-bars"></i>
    Menu
  </div>
</div>
<script src="app.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</body>
</html>
改变



您在
app.js
中的代码是使用
jQuery
编写的。 即使您需要
jQuery
$
,我仍然需要您的
app.js
您已经包含了
脚本标签
,用于在
app.js
之后包含
jQuery

因此,当加载
app.js
时,仍然没有
jQuery
,因此脚本失败

解决方案是首先包括
jQuery
,然后包括您的
app.js

更改

<script src="app.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>


您在
app.js
中的代码是使用
jQuery
编写的。 即使您需要
jQuery
$
,我仍然需要您的
app.js
您已经包含了
脚本标签
,用于在
app.js
之后包含
jQuery

因此,当加载
app.js
时,仍然没有
jQuery
,因此脚本失败


解决方案是首先包括
jQuery
,然后包括你的
app.js

非常感谢。。问题解决了。我改了这个,非常感谢你。。问题解决了。我把这个改成了
<script src="app.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="app.js"></script>