Commit 4e148ff0ec2a67a248dff7418a06b6430007e9f0
1 parent
596eb1fb
Exists in
master
and in
21 other branches
Fixed example for latest version of typeahead.js - closes #740, closes #759
Showing
1 changed file
with
11 additions
and
4 deletions
Show diff stats
README.md
... | ... | @@ -579,11 +579,18 @@ Then add the search box and JavaScript code to a view. |
579 | 579 | <input type="text" id="query" name="query" /> |
580 | 580 | |
581 | 581 | <script src="jquery.js"></script> |
582 | -<script src="typeahead.js"></script> | |
582 | +<script src="typeahead.bundle.js"></script> | |
583 | 583 | <script> |
584 | - $("#query").typeahead({ | |
585 | - name: "book", | |
586 | - remote: "/books/autocomplete?query=%QUERY" | |
584 | + var books = new Bloodhound({ | |
585 | + datumTokenizer: Bloodhound.tokenizers.whitespace, | |
586 | + queryTokenizer: Bloodhound.tokenizers.whitespace, | |
587 | + remote: { | |
588 | + url: '/books/autocomplete?query=%QUERY', | |
589 | + wildcard: '%QUERY' | |
590 | + } | |
591 | + }); | |
592 | + $('#query').typeahead(null, { | |
593 | + source: books | |
587 | 594 | }); |
588 | 595 | </script> |
589 | 596 | ``` | ... | ... |