Skip to content

Instantly share code, notes, and snippets.

@johnmmoss
Created October 17, 2015 14:53
Show Gist options
  • Save johnmmoss/6c448fa0a3c4ef11f534 to your computer and use it in GitHub Desktop.
Save johnmmoss/6c448fa0a3c4ef11f534 to your computer and use it in GitHub Desktop.
Typeahead and Bloodhound engine example
var bloodhound = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
remote:
{
url: baseUrl + '?q=%QUERY',
wildcard: '%QUERY',
}
});
bloodhound.initialize();
$('#bloodhound .typeahead').typeahead({
hint: true,
highlight: true,
},
{
name: 'states2',
displaykey: 'state',
source: bloodhound.ttAdapter()
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment