Last active
February 11, 2019 09:26
-
-
Save jharding/9458762 to your computer and use it in GitHub Desktop.
Example for http://twitter.github.io/typeahead.js/examples/.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="prefetch"> | |
<input class="typeahead" type="text" placeholder="Countries"> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var countries = new Bloodhound({ | |
datumTokenizer: Bloodhound.tokenizers.whitespace, | |
queryTokenizer: Bloodhound.tokenizers.whitespace, | |
// url points to a json file that contains an array of country names, see | |
// https://github.com/twitter/typeahead.js/blob/gh-pages/data/countries.json | |
prefetch: '../data/countries.json' | |
}); | |
// passing in `null` for the `options` arguments will result in the default | |
// options being used | |
$('#prefetch .typeahead').typeahead(null, { | |
name: 'countries', | |
source: countries | |
}); |
Hi, thank you for these examples very usefull .
I would like find words that begin by my input.
For example, I would like select only countries beginning by "O" and not countries with a "O".
Do you how can I do it?
thx.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any idea how to fetch an Apex controller method to get the data for prefetch and remote?