jquery - $ 是 jquery 中未定义的错误

标签 jquery twitter-bootstrap

我在使用 twitter bootstrap 时收到此错误。我在html中使用它时没有收到此错误。我将其转换为 WordPress 主题,现在我收到此错误。

<script src="http://twitter.github.com/bootstrap/assets/js/bootstrap-dropdown.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$('.dropdown-toggle').dropdown()
</script>

我收到这些错误。

  1. bootstrap-dropdown.js 第 72 行显示“$ 未定义”。
  2. "$(".dropdown-toggle").dropdown 不是函数"

非常感谢任何帮助。 谢谢。

编辑: 我试过这个https://stackoverflow.com/a/9301017/759257

并包含最新的 jquery 版本 1.7.1,现在它可以工作了!

最佳答案

您加载脚本的顺序错误。首先加载 jQuery,否则 Bootstrap 脚本将无法使用它。

关于jquery - $ 是 jquery 中未定义的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9313612/

相关文章:

javascript - JavaScript 中自动重新加载 'php'

javascript - 使内容不可滚动的CSS代码

javascript - 获取 Bootstrap Radio 插件选定的值

twitter-bootstrap - Bootstrap 下拉菜单不适用于输入组

css - Bootstrap 字形图标悬停仅部分着色

html - Div 100% 的视口(viewport)和内容

AJAX 提交前的 JavaScript 验证

javascript - fadeOut(...).removeClass 不是函数

jQuery:如果我使用 .html 设置元素的 html 内容,为什么它没有显示在源代码中

jquery - Wordpress 站点错误,文本框突然向上移动