laimison
laimison

Reputation: 1698

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>

Upvotes: 0

Views: 3714

Answers (2)

Daniel Taub
Daniel Taub

Reputation: 5369

<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.


Upvotes: 1

Sanchit Goel
Sanchit Goel

Reputation: 141

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

Upvotes: 2

Related Questions