在我的html页面中,我试图为自动完成添加“提前打字机”,但我无法解决一个与TypeError和TypeError相关的问题。
我在CodePen上试了一个样本,效果很好。单击此处
但是在实际的页面中,我得到了这些错误。
误差
ReferenceError: _ is not defined
.mixin(Typeahead.prototype, {
typeahe...?body=1 (line 87, col 2)
TypeError: $(...).typeahead is not a functionHTML代码
var subjects = ['PHP', 'MySQL', 'SQL', 'PostgreSQL', 'HTML', 'CSS', 'HTML5'];
$('#search').typeahead({source: subjects})JS文件配置
<%= javascript_include_tag 'jquery.js' %>
<%= javascript_include_tag 'angular.min.js' %>
<%= javascript_include_tag 'jquery-ui.min.js' %>
<%= javascript_include_tag 'bootstrap.3.2.js' %>
<%= javascript_include_tag 'typeahead.js' %>
<%= javascript_include_tag 'jquery.backstretch.min.js' %>
<%= javascript_include_tag 'jquery.scrollTo.min.js' %>请提出解决这个问题的建议。我几乎没有看到谷歌和堆栈溢出的解决方案,但什么也没有奏效。

请查看更新的应答区域
发布于 2014-10-09 19:56:05
非常愚蠢的错误-也许我错了.
我发现了我添加的引导Javascript JS文件的问题。
在示例代码中,我添加了引导程序2.3.2版本,运行良好。
twitter-bootstrap/2.3.2/js/bootstrap.min.js但是在我的html页面中,我添加了引导3.2js版本,并按照我的假设创建了冲突。
<%= javascript_include_tag 'bootstrap.3.2.js' %>现在我刚刚用2.3.2版本替换了3.2版本,运行良好.
https://stackoverflow.com/questions/26286209
复制相似问题