简体   繁体   中英

Basic bootstrap typeahead with example

For some reason basic typeahead example doesn't work on any of my web servers, but I'm able to get it working here - http://jsfiddle.net/H4Qmh/12/

Any differences or issue in the code below comparing with code posted on jsfiddle? Can you confirm that code below works for you? (You should be able to see results just by typing h, i or s)

<html>
<head>
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/jquery.js" type="text/javascript"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.js" type="text/javascript"></script>
</head>
<body>
<div class="well">
<input autocomplete="off" type="text" class="span3" data-provide="typeahead" data-items="4" placeholder="Type in letter h, i or s" data-source='["iPhone", "HTC", "Samsung"]' >
</div>
</body>
</html>

I have just replaced your bootstrap with the bootstrap typeahead js file. and it starts running.

https://github.com/biggora/bootstrap-ajax-typeahead/tree/master/src

<html>
<head>

    <!--    jquery-->
    <script src="https://code.jquery.com/jquery.js"></script>

    <!-- Bootstrap -->
  <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.js"></script>
</head>
<body>
    <div class="well">
        <input autocomplete="off" type="text" class="span3" data-provide="typeahead" data-items="4" placeholder="type in letter h, i or s" data-source='["iPhone", "HTC", "Samsung"]'>
    </div>
</body>
</html>

Your bootstrap cdn link was returning you an HTML file and not a CSS file.


The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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