简体   繁体   English

Twitter-Bootstrap提前无法正常工作

[英]Twitter-Bootstrap typeahead not working

I'm having some trouble getting the typeahead working in Bootstrap, and I've boiled the problem down to this short example. 我在Bootstrap中无法正常工作时遇到了一些麻烦,并将问题归结为这个简短的示例。 (I'm new to Bootstrap.) When I type in the input, no typeahead suggestions appear. (我是Bootstrap的新手。)在输入中键入内容时,不会出现任何提前输入的建议。 Any ideas why this isn't working? 任何想法为什么这不起作用?

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
        <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
    </head>
    <body>
        <div class="container">
            <label for="primaryCustName">Name:</label>
            <input type="text" data-provide="typeahead" data-source="['Bob','Jim','Sue']" class="form-control" id="primaryCustName">
        </div>
    </body>
</html>

The typeahead function was removed from Bootstrap in v3. 预先输入功能已从v3中的Bootstrap中删除。 According to @mdo it was dropped "in favor of folks using Twitter's typeahead. Twitter's typeahead has more features than the old bootstrap-typeahead.js and less bugs." 根据@mdo的说法,它被“赞成使用Twitter的typeahead的人们使用。Twitter的typeahead具有比旧的bootstrap-typeahead.js更多的功能,并且错误更少”。

Your two options from here are: 您在这里有两个选择:

  1. Use a port of Bootstrap v2 Typeahead, you can find one here . 使用Bootstrap v2 Typeahead的端口,您可以在此处找到一个。

  2. Use Twitter Typeahead which can be found here . 使用Twitter Typeahead,可以在这里找到。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM