簡體   English   中英

Typeahead不適用於Bootstrap 3

[英]Typeahead doesn't work with Bootstrap 3

我無法使它工作。 我在控制台上沒有任何錯誤。 該列表根本沒有出現。

這是我的html代碼:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/typeahead.jquery.js"></script>


<form method="POST" class="search-form" name="search-form">
    <input id="keywords" name = "searchtext" type="text" class="search-input" placeholder="Enter your text..." autocomplete="off">
    <button type="submit" class="search-submit">Search Now</button>
</form>

<script type="text/javascript">
    $(function(){

      // applied typeahead to the text input box
      $('#keywords').typeahead({
        name: 'keywords',

        // data source
        local: ['pattern recognition', 'supervised learning', 'support vector machines'],

        // max item numbers list in the dropdown
        limit: 10
      });

    });
</script>

問題在於,Bootstrap 3不像2.3和更早版本那樣包含預輸入庫。 您所包括的typeahead.js庫的工作方式大不相同, 這里此處都有一些很好的示例說明了如何使用它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM