TypeError:$(...)。typeahead不是函数 [英] TypeError: $(...).typeahead is not a function

查看:81
本文介绍了TypeError:$(...)。typeahead不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是非常基本的代码。我仍然面临一个问题。我想我错过了一些东西,如bootstrap网站上提到的那样

This is very basic code. Still I am facing a problem. I think I am missing something, as mentioned on bootstrap site


插件可以单独包含(虽然有些需要
依赖项)或者一次性全部.bootstrap.js和bootstrap.min.js
都包含单个文件中的所有插件。

"Plugins can be included individually (though some have required dependencies), or all at once. Both bootstrap.js and bootstrap.min.js contain all plugins in a single file."

所以我包含了boostrap.js并且仍然遇到了这个错误,其他依赖项是什么?

So I included boostrap.js and still getting that error, what are the other dependencies?

下面是代码。

<!DOCTYPE html>
<html>
    <head>
        <title>Member</title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <script type="text/javascript" src="js/jquery.js"></script>
        <script type="text/javascript" src="js/bootstrap.min.js"></script>
        <link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
    </head>
    <body>
<div class="well">  
<input type="text" class="span3" id="search" data-provide="typeahead" data-items="4" />  
</div>
<script>  
 var subjects = ['PHP', 'MySQL', 'SQL', 'PostgreSQL', 'HTML', 'CSS', 'HTML5', 'CSS3', 'JSON'];   
$('#search').typeahead({source: subjects})  
</script>
    </body>
</html>



问候



Aadam

Regards

Aadam

推荐答案

如果您看到错误消息TypeError:$(...)。typeahead不是函数,则表示未提供typeahead函数你正在使用的bootstrap版本。
正式从新版本3.0中删除了typeahead。并且可以在typeahead.js中单独使用。

if you see the error message "TypeError: $(…).typeahead is not a function" it mean typeahead function is not provided in the version of bootstrap you are using. Officially the typeahead is dropped from the new release 3.0. And is available separtely in typeahead.js.

你需要包含错误将删除的typeahead.js插件。

you need to include the the typeahead.js plugin the error will remove.

这篇关于TypeError:$(...)。typeahead不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆